My brain hurts
I've been trying to code my flash game to send its variables to PHP so I can then put them in to mySQL
I think my code must be missing something crucial- I've worked it out as best I can but it still doesn't want to send the variables through
ACTIONSCRIPT
Code: Select all
on (release) {
if (_root.user != "Type your name here" && _root.email != "Type your email here") {
var formPost = new LoadVars();
formPost.user = _root.user;
formPost.score = _root.score;
formPost.email = _root.email;
formPost.sendAndLoad(" (php website) ","POST");
gotoAndStop(5);
}
}
}this is the PHP here
Code: Select all
<?
$user= $_POST['formpost.user'];
$score= $_POST['formpost.score'];
$email= $_POST['formpost.email'];
$db= mysql_connect(" ( database) ", "user", "password");
mysql_select_db("table name",$db);
$result = mysql_query("INSERT INTO tff_fishfrenzyscores (user,score,email) VALUES ($user,$score,$email)",$db);
?>Set up the database and select the table
Insert into the relevant columns the posted data.
End.
(I have some fake data in my table and have managed to set up the flash file to read the sql but I can't get the submittal to work)