MySQL Error -
ProjectGANTON - 12.08.2012
Where's the error?
http://gyazo.com/6b3e7cc74b38e71928de407c46a495ae
Код:
new Float:px,Float:py,Float:pz;
GetPlayerPos(playerid,px,py,pz);
Giocatore[playerid][APOS][0] = px;
Giocatore[playerid][APOS][1] = py;
Giocatore[playerid][APOS][2] = pz;
format(queryString, sizeof(queryString), "UPDATE utenti SET rank = '%d', soldi = '%d', id = '%d', level = '%d', experience = '%d', maxexp = '%d', tutorial = '%d'",Giocatore[playerid][rank],Giocatore[playerid][soldi],Giocatore[playerid][id],Giocatore[playerid][livello],Giocatore[playerid][exp],Giocatore[playerid][maxexp],Giocatore[playerid][tutorial]);
format(queryString, sizeof(queryString),"%s, CX = '%f', CY = '%f', CZ = '%f WHERE username = '%s'",queryString,Giocatore[playerid][APOS][0],Giocatore[playerid][APOS][1],Giocatore[playerid][APOS][2],NomeX(playerid));
mysql_query(queryString);
mysql_store_result();
mysql_free_result();
First it was working fine, now there's a problem.. help!
Re: MySQL Error -
Kindred - 12.08.2012
pawn Код:
format(queryString, sizeof(queryString), "UPDATE utenti SET rank = '%d', soldi = '%d', id = '%d', level = '%d', experience = '%d', maxexp = '%d', tutorial = '%d'",Giocatore[playerid][rank],Giocatore[playerid][soldi],Giocatore[playerid][id],Giocatore[playerid][livello],Giocatore[playerid][exp],Giocatore[playerid][maxexp],Giocatore[playerid][tutorial]);
format(queryString, sizeof(queryString),"%s, CX = '%f', CY = '%f', CZ = '%f WHERE username = '%s'",queryString,Giocatore[playerid][APOS][0],Giocatore[playerid][APOS][1],Giocatore[playerid][APOS][2],NomeX(playerid));
You are formatting it twice, therefore after you format it the first time, the string will only be the second format.
If you format directly after another format without doing anything to the first format, it will be overwrited.
pawn Код:
new queryString2[256]; //Change to string length
format(queryString, sizeof(queryString), "UPDATE utenti SET rank = '%d', soldi = '%d', id = '%d', level = '%d', experience = '%d', maxexp = '%d', tutorial = '%d'",Giocatore[playerid][rank],Giocatore[playerid][soldi],Giocatore[playerid][id],Giocatore[playerid][livello],Giocatore[playerid][exp],Giocatore[playerid][maxexp],Giocatore[playerid][tutorial]);
format(queryString2, sizeof(queryString),"%s, CX = '%f', CY = '%f', CZ = '%f WHERE username = '%s'",queryString,Giocatore[playerid][APOS][0],Giocatore[playerid][APOS][1],Giocatore[playerid][APOS][2],NomeX(playerid));
strcat(queryString, queryString2); //Add queryString2 to queryString.
Try this
Re: MySQL Error -
ProjectGANTON - 12.08.2012
Doesn't work.
Re: MySQL Error -
[MG]Dimi - 12.08.2012
Quote:
Originally Posted by Kindred
pawn Код:
format(queryString, sizeof(queryString), "UPDATE utenti SET rank = '%d', soldi = '%d', id = '%d', level = '%d', experience = '%d', maxexp = '%d', tutorial = '%d'",Giocatore[playerid][rank],Giocatore[playerid][soldi],Giocatore[playerid][id],Giocatore[playerid][livello],Giocatore[playerid][exp],Giocatore[playerid][maxexp],Giocatore[playerid][tutorial]); format(queryString, sizeof(queryString),"%s, CX = '%f', CY = '%f', CZ = '%f WHERE username = '%s'",queryString,Giocatore[playerid][APOS][0],Giocatore[playerid][APOS][1],Giocatore[playerid][APOS][2],NomeX(playerid));
You are formatting it twice, therefore after you format it the first time, the string will only be the second format.
If you format directly after another format without doing anything to the first format, it will be overwrited.
pawn Код:
new queryString2[256]; //Change to string length format(queryString, sizeof(queryString), "UPDATE utenti SET rank = '%d', soldi = '%d', id = '%d', level = '%d', experience = '%d', maxexp = '%d', tutorial = '%d'",Giocatore[playerid][rank],Giocatore[playerid][soldi],Giocatore[playerid][id],Giocatore[playerid][livello],Giocatore[playerid][exp],Giocatore[playerid][maxexp],Giocatore[playerid][tutorial]); format(queryString2, sizeof(queryString),"%s, CX = '%f', CY = '%f', CZ = '%f WHERE username = '%s'",queryString,Giocatore[playerid][APOS][0],Giocatore[playerid][APOS][1],Giocatore[playerid][APOS][2],NomeX(playerid)); strcat(queryString, queryString2); //Add queryString2 to queryString.
Try this
|
It can be done on way he did it. Now reason why it probably doesn't work is, and I said this really one million times, ALL column names and tables names MUST be inside `` and all values between ' '. Like that you will remove possibilty that SQL Syntax error occurs.