When restart the game, the scores are replaced in DB

Discussion and feedback on Construct 2

Post » Sat Oct 10, 2015 3:15 am

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

Image
Image

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!
B
4
Posts: 50
Reputation: 290

Post » Sat Oct 10, 2015 3:52 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,313
Reputation: 71,094


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests