Sql syntax
#1

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?
Reply
#2

Well what's the error?
Reply
#3

You've an error in your SQL syntax, near line [...] (error line is in mysql_format.
Reply
#4

Replace %s with '%s'

If `ID` is primary key (which it should be), the LIMIT clause is not needed.
Reply
#5

What a stupid, lol. Thanks!

Yes, ID is primary key. Cheers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)