MySQL code not working :X - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL code not working :X (
/showthread.php?tid=265661)
MySQL code not working :X -
ben4uka - 01.07.2011
Код:
new Pname[24];
GetPlayerName(playerid, Pname, 24);
new escpname[24];
mysql_real_escape_string(Pname, escpname);
format(query, sizeof(query), "UPDATE `users` SET `Points` = '%d',`AdminLevel` = '%d', `Level` = '%d'", PlayerInfo[playerid][Points], PlayerInfo[playerid][AdminLevel], PlayerInfo[playerid][Level], escpname);
mysql_query(query);
mysql_free_result();
showing:
Код:
C:\Documents and Settings\тшех дчрйеъ\щемзп дтбегд\щшъ\gamemodes\esw.pwn(1389) : error 076: syntax error in the expression, or invalid function call
AW: MySQL code not working :X -
Blowfish - 01.07.2011
Код:
format(query, sizeof(query), "UPDATE `users` SET `Points` = '%d',`AdminLevel` = '%d', `Level` = '%d'", PlayerInfo[playerid][Points], PlayerInfo[playerid][AdminLevel], PlayerInfo[playerid][Level], escpname);
Something like
is missing in the end of your query string.
Re: MySQL code not working :X -
ben4uka - 01.07.2011
still have the error..
AW: MySQL code not working :X -
Blowfish - 01.07.2011
Would be great if you posted your new code and added line numbers.
Re: MySQL code not working :X -
ben4uka - 01.07.2011
Код:
1385 new Pname[24];
1386 GetPlayerName(playerid, Pname, 24);
1387 new escpname[24];
1388 mysql_real_escape_string(Pname, escpname);
1399 format(query, sizeof(query), "UPDATE `users` SET `Points` = '%d', `AdminLevel` = '%d', `Level` = '%d' WHERE `Nick` = '%s'", PlayerInfo[playerid][Points], PlayerInfo[playerid][AdminLevel], PlayerInfo[playerid][Level], escpname);
1400 mysql_query(query);
1401 mysql_free_result();
AW: MySQL code not working :X -
Blowfish - 01.07.2011
Why don't you use escpname?
And I'm not quite sure how you want to make a function that actually returns a string.
Re: MySQL code not working :X -
ben4uka - 01.07.2011
lol i edited it, and i still have the error..
AW: MySQL code not working :X -
Blowfish - 01.07.2011
Again. Code would be really great to help you.
Edit: Ahh, i see you edited it in the above post.
Re: MySQL code not working :X -
Calgon - 01.07.2011
We need line 1389, not 1399.
AW: MySQL code not working :X -
Blowfish - 01.07.2011
BTW: What do you use mysql_free_result for there? It's not really necessary there.