0 Favourites

Ajax Request PHP File

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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:

    $id_user = $_GET['id_user'];[/code:cj5ztuez]
    
    Within Construct, you will need to add that parameter to your request URL to something like this:
    
    [code:cj5ztuez]Request "http://localhost/mygame/myscore.php?id_user=" &WHATTHEUSERIDIS" (tag "MyScore")[/code:cj5ztuez]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)