Sql syntax - 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: Sql syntax (
/showthread.php?tid=663221)
Sql syntax -
SymonClash - 25.01.2019
Mysql log says i've an error in this syntax to save stats:
pawn Code:
mysql_format(g_SQL, query,sizeof(query), "UPDATE `players` SET `Kills` = %d, `Deaths` = %d, `Score` = %i, `Money` = %i, `LastLoginDate` = %s, `LastLoginIP` = %s, `AdminLevel` = %d WHERE `ID` = %d LIMIT 1",
Player[p][Kills], Player[p][Deaths], GetPlayerScore(p), GetPlayerMoney(p), ReturnDate(), ReturnPlayerIp(p), Player[p][AdminLevel], Player[p][ID]);
mysql_query(g_SQL, query);
And effectively, stats aren't saved. What i did wrong?
Re: Sql syntax -
Kane - 25.01.2019
Well what's the error?
Re: Sql syntax -
SymonClash - 25.01.2019
You've an error in your SQL syntax, near line [...] (error line is in mysql_format.
Re: Sql syntax -
Calisthenics - 25.01.2019
Replace %s with '%s'
If `ID` is primary key (which it should be), the LIMIT clause is not needed.
Re: Sql syntax -
SymonClash - 25.01.2019
What a stupid, lol. Thanks!
Yes, ID is primary key. Cheers