Syntax error
#1

I'm having this syntax error:

Quote:

[04:24:25] [DEBUG] mysql_tquery - scheduling query "UPDATE `players` SET `VipTime`=0, `Warns`=3, `Cookies`=89, `Jailed`=0, `Muted`=0, `RegisterDate`=0, `Duty`=0, `Nopm`=0 WHERE `ID`=0"..
[04:24:25] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[04:24:25] [ERROR] CMySQLQuery::Execute[()] - (error #1064) 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 'WHERE `ID`='

In this code:

Код:
stock SaveStatsForPlayer(playerid)
{
    new query[700], query2[500];
    mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Deaths`=%d, `Score`=%d, `Money`=%d, `MissionsPlayed`=%d, WHERE `ID`=%d", IP[playerid], pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Deaths], GetPlayerScore(playerid), pData[playerid][Money], pData[playerid][MissionsPlayed]);
	mysql_format(mysql, query2, sizeof(query2), "UPDATE `players` SET  `VipTime`=%d, `Warns`=%d, `Cookies`=%d, `Jailed`=%d, `Muted`=%d, `RegisterDate`=%d, `Duty`=%d, `Nopm`=%d WHERE `ID`=%d", pData[playerid][VipTime], pData[playerid][Warns], pData[playerid][Cookies], pData[playerid][Jailed], pData[playerid][Muted], pData[playerid][RegisterDate],pData[playerid][Duty], pData[playerid][Nopm], pData[playerid][ID]);
    mysql_tquery(mysql, query, "", "");
    mysql_tquery(mysql, query2, "", "");
}
What's wrong?
Reply
#2

Just remove ' , ' at the last table.
E.g
Код:
UPDATE `players` SET 
`IP`='%s', 
`Admin`=%d, 
`VIP`=%d, 
`Deaths`=%d, 
`Score`=%d, 
`Money`=%d,
`MissionsPlayed`=%d, // Remove this ' , '
WHERE `ID`=%d
Hope you'll understand
Reply
#3

Quote:

[04:49:15] [DEBUG] mysql_tquery - scheduling query "UPDATE `players` SET `VipTime`=0, `Warns`=3, `Cookies`=89, `Jailed`=0, `Muted`=0, `RegisterDate`=0, `Duty`=0, `Nopm`=0 WHERE `ID`=0"..
[04:49:15] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[04:49:15] [ERROR] CMySQLQuery::Execute[()] - (error #1064) 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 '' at line 1

Same..
Reply
#4

Bump, i really need this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)