Results 1 to 3 of 3

Thread: Help with flash + php + mysql

  1. #1
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Help with flash + php + mysql

    Hey,
    First of all, HI, just got in this place, which looks like a helpful community .
    I've set up a mysql server with the latest php, mysql.
    I have a flash form with name, email, and comment fields.
    These are named as variables : nameField, emailField, and messageField.
    I have a submit button with this script:
    on (release) {
    Status = "Sent";
    loadVariablesNum ("index.php?nameField="+nameField, 0) & ("index.php?emailField="+emailField, 0) & ("index.php?commentField="+commentField, 0);

    }
    This is supposed to post the fields into my php file : index.php.
    Here is my index.php :

    <?
    include ('Include.inc');

    $nameField = $_GET['messageField'];
    $emailField = $_GET['emailField'];
    $messageField = $_GET['messageField'];

    $Connect = mysql_connect($DBhost, $DBuser, $DBpass);
    @mysql_select_db("$DBName");

    $query = "INSERT INTO $table (usercomment, useremail, username) VALUES ('$messageField' , '$emailField', '$nameField')";
    $result = mysql_query($query);

    $numR = mysql_affected_rows($Connect);

    if ($numR == 0) {
    print "Status=Failure, Please Fill out all Fields";
    }
    else if ($numR == 1) {
    print "Status=Sent";
    }

    else { print "Status=General Error - Try Later";
    }


    ?>
    The thing is that on my mysql database I am getting 3 seperate rows all blank and only on one does the emailField get inserted.

    As in:
    ID | usercomment | useremail | username
    1 |_____________|__________|_________
    2 |_____________|__________|_________
    3 |_____________|____test___|_________


    Please help, would be appreciated.

  2. #2
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default edit

    Now somehow I fixed it, by going back steps.

    But my mysql database is being filled in still in 3 rows :

    ID | usercomment | useremail | username
    1 |___comment___|__________|_________
    2 |_____________|___email___|_________
    3 |_____________|__________|__name___

    I suppose it has something to do with my submit button, but I dont know how to join the loadVariablesNum.

    on (release) {
    loadVariablesNum ("index.php?emailField="+emailField, 0);
    loadVariablesNum ("index.php?nameField="+nameField, 0);
    loadVariablesNum ("index.php?messageField="+messageField, 0);

    }

  3. #3
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Figured it out

    Hey lol,
    I guess I just had to spend some alone time with my code to figure it out.
    I fixed up my submit button in the flash document as this:

    on (release) {

    loadVariablesNum ("index.php?emailField="+emailField+"&nameField="+nameField+"&messageField="+messageField, 0);

    }
    So that is how I fixed my code.
    This is a very simple Flash + Mysql + PHP integration, I learned a lot on this lil journey heh.
    If anyone tries it out and has some problems dont hesitate on asking me, cause I went by all the problems there could be and figured them out painfully by myself .
    Have a good day.

Bookmarks

Posting Permissions

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