MySQL syntax error
#1

I'm getting mysql syntax error (You have a SQL error in your syntax) here:

pawn Код:
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `LastLogin` = %s, `Kills` = %d, `Deaths` = %d, `Score` = %i, `Money` = %i, `Level` = %d, `WantedLevel` = %d, `Skin` = %d, `PlayerTeam` = %d, `PlayerGender` = %d, `PlayingHours` = %d, `PlayingMinutes` = %d, `FirstSpawn` = %d WHERE `id` = %d LIMIT 1",
What's wrong?
Reply
#2

Код:
LastLogin ='%s'
Also there's no need for a LIMIT clause.
Reply
#3

I never used ' ' for %s or %d values and always worked in that way.

I edited before the query to add new data to update and got this sql error.
Reply
#4

Well you should use it for %s.
Reply
#5

%s and %e.
Reply
#6

Ok now saving works. Getting now sql syntax error here:

pawn Код:
new query[128];
    format(query, sizeof(query), "UPDATE `players` SET `RegisterDate` = '%s', `RegisterIP` = '%s', `LastLogin` = '%s' WHERE `username` = '%s'", ReturnDate(), ReturnPlayerIp(playerid), ReturnDate(), Player[playerid][Name]);
    mysql_tquery(g_SQL, query);
RegisterDate and RegisterIP doesn't get saved.
Reply
#7

128 doesn't seem to be enough for that query.
Reply
#8

Yeah you were right, now works. Thank you.

If you could help me with this too: https://sampforum.blast.hk/showthread.php?pid=4043064#pid4043064

I'll appreciate it much since i'm struggling with that from days.

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)