Ajax Request PHP File

Discussion and feedback on Construct 2

Post » Wed Mar 12, 2014 4:14 pm

Hi Guys!!
I have build HTML5 Game, with construct 2 r139
I try to input and retrieve data from database with php
input data was successful, but when i try to retrieve data Using Ajax Request it was nothing, just blank!
and Ajax is never complete.

this is my score.php file value
<?php
include_once"connection.php";
$qlogin = mysql_query("select id_user, score from score_table ");
while($xx=mysql_fetch_array($qlogin)){
echo $xx['score']."|".$xx['id_user']."|";
}
mysql_close();
?>

and this is my Ajax Request code:
Request "http://localhost/mygame/myscore.php" (tag "MyScore")

Please help me.. i do need it.
B
4
S
1
Posts: 34
Reputation: 443

Post » Wed Mar 12, 2014 4:36 pm

what is "id_user"? You didnt specify what the value of id_user is, so it will return null. You are selecting something that doesn't even exist, which is selecting " ", an empty value.

You will need something like this:


Code: Select all
$id_user = $_GET['id_user'];



Within Construct, you will need to add that parameter to your request URL to something like this:

Code: Select all
Request "http://localhost/mygame/myscore.php?id_user=" &WHATTHEUSERIDIS" (tag "MyScore")
B
17
S
6
Posts: 348
Reputation: 2,608


Return to Construct 2 General

Who is online

Users browsing this forum: megatronx and 8 guests