A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: SQL tables being made but populating empty?

  1. #1
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392

    SQL tables being made but populating empty?

    Hey hey, Just followed the Ultra Simple PHP Flash Login tutorial. Was looking for some easy log in type script for a project. This ended up being closest to what I wanted.

    So here is the deal, I uploaded everything, added my DB info, created the table and put the code on the buttons.

    When testing I created a test user. Everything worked. Yay. I went back and created a second user. Everything seemed to work. However when I tried to log in as second user I was denied.

    So I went to phpmyadmin and checked it out. in the table there were 2 cells, one had the username and password for the first user, the second had the cell but no info. (username and password were blank).

    I deleted cell 2 and registered again. Same thing. left it alone, tried to register again and was given the error "username already exists" even though it didn't. (user 1 = Testing, User 2 = Bobby, User 3 = Richard).

    So, my concern then, is why does everything seem to work, and why does the cell get created, but the information isn't passed through, when it does the first time?

    Ideas?

    ~MoN
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Location
    Devon, UK
    Posts
    8
    Hey,

    Without being specific to that tutorial (as I haven't read it) generally the method would be to try calling the PHP file directly in your browser rather than via Flash.

    Firstly - it may display errors that Flash naturally wouldn't see. If not, try turning on errors
    PHP Code:
    ini_set('display_errors',1);
    error_reporting(E_ALL|E_STRICT); 
    This may find things that you didn't already see go wrong.

    Next, before the SQL INSERT query, var_dump() or print_r() the variables that are being inserted - or even the entire query. Clearly the username/password is being set to nothing which is why the duplicate user error is appearing. You can use var_dump liberally throughout the program to diagnose where the problem lies. You'll need to manually populate the URL just like the Flash program would
    (e.g., login.php?username=Mark&password=Hughes)

    HTH,
    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center