Results 1 to 1 of 1

Thread: (+ Flash actually) What on earth is going on?

  1. #1
    44
    posts
    Registered User

    (+ Flash actually) What on earth is going on?

    Hi there.

    I am building a Flash game and I prepare to design a high score table for it. I've got a server running. Since this is my first time doing PHP and Flash together, I first designed a form so I just need to input values for different fields in order to create a record on the high score table (as seen in my attached .fla).

    The table on my database has the following structure:

    player_id: auto_increment (primary key)
    player_name: varchar(20)
    time_complete: int(4)
    resources: int(4)
    accuracy: int(3)
    combo: int(4)
    general: int(4)

    Quite straight forward actually.

    Next, I use the following php script to process the data when I press "submit" on my form.

    PHP Code:
    <?php
     
    //retrieving data from Flash
     
    $player $_POST['player_name'];
     
    $time $_POST['time_complete'];
     
    $resources $_POST['resources'];
     
    $accuracy $_POST['accuracy'];
     
    $combo $_POST['combo'];
     
    $general $_POST['general'];
     
    //end retrieving data from Flash
     //connect to database
     
    $link mysql_connect("(my server name)","(my user name)","(my password)");
     if (!
    $link) {
      print 
    "stat=Not connected.";
     } else {
      print 
    "stat=Connected.";
     }
     
    //end connect to database
     //sending scores to database
     
    mysql_select_db("xth_4326941_highscore",$link);
     
    $q_insert "INSERT INTO score (player_name,time_complete,resources,accuracy,combo,general) VALUES ('$player','$time','$resources','$accuracy','$combo','$general')";
     
    mysql_query($q_insert);
     
    /*$q_check = "SELECT * FROM score";
     $q_check_result = mysql_query($q_check);
     while($row = mysql_fetch_array($q_check_result)) {
      print "stat=$row['player_name']";
     }*/
     //end sending scores to database
     //close conection
     
    mysql_close($link);
     
    //end close connection
    ?>
    The connection is made successfully as displayed by the dynamic text box with the variable name "stat". The problem is that the data in the new record inserted that way became some rubbish.

    player_name: <TEXTFORMAT LEADING= //****
    time_complete: 0
    resources: 0
    accuracy: 0
    combo: 0
    general: 0

    **** it's really like that. "<TEXTFORMAT LEADING=". And nothing else.

    compared with what I have submitted:

    player_name: oi
    time_complete: 98
    resources: 98
    accuracy: 98
    combo: 98
    general: 98

    You'll all agree that it is quite rubbish.

    Anyone knows what on earth is going on? A problem with my table (created with phpmyadmin)? Or something wrong with my server? or as simple as some silly mistakes in my script?

    Thanks in advance.
    Attached Files Attached Files
    Last edited by wkt; October 27th, 2009 at 05:45 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012