MySQL code not working :X
#1

Код:
	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
Reply
#2

Код:
	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
Код:
WHERE `name` = '%s'
is missing in the end of your query string.
Reply
#3

still have the error..
Reply
#4

Would be great if you posted your new code and added line numbers.
Reply
#5

Код:
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();
Reply
#6

Why don't you use escpname?
And I'm not quite sure how you want to make a function that actually returns a string.
Reply
#7

lol i edited it, and i still have the error..
Reply
#8

Again. Code would be really great to help you.

Edit: Ahh, i see you edited it in the above post.
Reply
#9

We need line 1389, not 1399.
Reply
#10

BTW: What do you use mysql_free_result for there? It's not really necessary there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)