0 Favourites

When restart the game, the scores are replaced in DB

  • Hello

    I have a game that saves scores in a database.

    To submit the scores to the database using AJAX, and the hosting of the receive PHP files .

    The php checks if the score is sent greater score in the existing database , and if greater , stores , and if less discards .

    The game works well , keep the scores are higher every time , but I have a problem.

    If I close the game and I open omits the previous score and overwritten by the new being even lower.

    It seems that everything resets to write again , but does not respect the saved score above.

    For example:

    If in the first run i get 25 points, after 75 points, the last value saved in DB is 75 because is greater than 25.

    If after i close the game and run again, if the first try i get 25, normally the game should to conserve the 75 points, but in this case ocurrs a error and the 75 points are changed for the 25 points, still if 25 < 75.

    What's going on?

    This is the PHP

    Is writed in spanish.

    The parameters U, PM, PS, PR PM, PT, are sent by AJAX in the normal way (with request URL etc....)

    example

    Request "URL/updatescore.php?U="& IDUser & "&PS=" & Score

    Any error in the PHP?

    Thanks!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You'd likely have more efficient answers asking a PHP dedicated community to check your script.

    This is out of the scope of C2 forums.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)