Money saving problem
#1

Hi..
So I'm having a little problem when I save the player's money in a DB.
I have this at "OnPlayerDisconnect"
pawn Код:
format(string, sizeof(string), "UPDATE `user` SET `money`=%d AND `score`=%d WHERE `name`='%s'", GetPVarInt(playerid, "Money"), GetPlayerScore(playerid), name);
mysql_query(string);
However it always sets the player's money to "1" (while playing it is correct though)
Reply
#2

When you're setting the data you just need to put a , when you wish to add something new.

pawn Код:
format(string, sizeof(string), "UPDATE `user` SET `money`= %d, `score`= %d WHERE `name`= '%s'", GetPVarInt(playerid, "Money"), GetPlayerScore(playerid), name);
mysql_query(string);
Something like that should work fine.
Reply
#3

You shouldn't need to use AND in any of your update queries. It is solely used in the WHERE clause of a query. Use commas instead.
Код:
`money`=%d,`score`=%d
Edit: 2slow
Reply
#4

hm is this also the source of the actual problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)