- Home /
Problems with passing data to php script
Hi all
I was following the instructions given in this tutorial. I've found that the "name" and "score" variables being used to transfer data between the HSController.js and the getScores.js are not working. Is this a feature specific to the Pro version or am I doing something wrong?
here is my code:
$hostname='localhost';
$username ='########';
$password='########';
$database='########';
//Connect to the database
$db= mysql_connect($hostname, $username, $password);
mysql_select_db($database);
//Strings must be escaped to prevent SQLInjection attack
$name = mysql_real_escape_string($_GET['name']);
$score = mysql_real_escape_string($_GET['score']);
mysql_query ("UPDATE xyztable SET q1=$score WHERE Name='$name';")
or die("Couldnot update database:".mysql_error());
And this his how I call the php file from unity:
var postScoreURL = "http://localhost/WebPlayer/getScore.php?"+"name="
+WWW.EscapeURL(name)+"&score="+WWW.EscapeURL(score);
var hs_post:WWW=WWW(postScoreURL);
yield hs_post;
Comment
Your answer
