SA-MP Forums Archive
MySQL error 0 [Help] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL error 0 [Help] (/showthread.php?tid=457040)



MySQL error 0 [Help] - George_Fratelli - 08.08.2013

Yeah, I get this error in the server.exe whenever a player disconnects my server and the data does not save.

pawn Код:
Error (0): Failed to exeute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id` = '1' LIMIT 1' at line 1.
The code:

pawn Код:
SavePlayer(playerid)
{
    if(pInfo[playerid][Logged] == 1)
    // checks if the player is logged
    {
        new Query[500];
        format(Query, 500, "UPDATE `playerdata` SET `admin` = '%d', `score` = '%d', `money` = '%d', `kills` = '%d', `deaths` = '%d', `sec` = '%d', `min` = '%d', `hour = '%d' WHERE `id` = '%d'",
        pInfo[playerid][pAdmin],
        pInfo[playerid][pKills],
        GetPlayerMoney(playerid),
        pInfo[playerid][pKills],
        pInfo[playerid][pDeaths],
        pInfo[playerid][pSec],
        pInfo[playerid][pMin],
        pInfo[playerid][pHour],
        pInfo[playerid][ID]);
        mysql_query(Query);
//this basically gets the variables and stores it to the players special identifier called "ID".
    }
}

EDIT: Nevermind, I've fixed it already.