SA-MP Forums Archive
CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your - 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)
+--- Thread: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your (/showthread.php?tid=651819)



CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your - akib - 28.03.2018

I am facing a proble, while i try to save stats on mysql database...

here is the code :
PHP Code:
SavePlayer(playerid)
{
    new 
Float:x,Float:y,Float:z,Float:Angle;
    
GetPlayerFacingAngle(playeridAngle);
    
GetPlayerPos(playeridFloat:xFloat:yFloat:z);
    
sInfo[playerid][money] = GetPlayerMoney(playerid);
    
sInfo[playerid][level] = GetPlayerScore(playerid);
    
sInfo[playerid][s_posx] = x;
    
sInfo[playerid][s_posy] = y;
    
sInfo[playerid][s_posz] = z;
    
sInfo[playerid][s_angle] = Angle;
    new 
query[128];
    
format(querysizeof(query), "UPDATE users SET money='%i', level='%i', pos_x='%f', pos_y='%f', pos_z='%f', angle='%f' WHERE id='%i'"sInfo[playerid][money],sInfo[playerid][level],sInfo[playerid][s_posx],sInfo[playerid][s_posx],sInfo[playerid][s_posz],sInfo[playerid][s_angle],sInfo[playerid][db_id]);
    
mysql_function_query(dbhandlequeryfalse"""");
return 
1;




Re: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to - Dayrion - 28.03.2018

Instead of posting the error as the title, post the full logs associate in the post.


Re: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to - AdamsLT - 28.03.2018

The syntax seems fine. You sure this is the correct error line?
Post the full error logs like Dayrion asked.

Unrelated to the error: when formatting the query you use s_posx twice (for both X and Y coords).


Re: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to - akib - 28.03.2018

Quote:
Originally Posted by Dayrion
View Post
Instead of posting the error as the title, post the full logs associate in the post.
Sorry for the mistake....

Quote:
Originally Posted by AdamsLT
View Post
The syntax seems fine. You sure this is the correct error line?
Post the full error logs like Dayrion asked.

Unrelated to the error: when formatting the query you use s_posx twice (for both X and Y coords).
the whole mysql log have only 1 error line...
Pic



Re: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to - ForCop - 28.03.2018

Quote:
Originally Posted by akib
View Post
I am facing a proble, while i try to save stats on mysql database...

here is the code :
PHP Code:
SavePlayer(playerid)
{
    new 
Float:x,Float:y,Float:z,Float:Angle;
    
GetPlayerFacingAngle(playeridAngle);
    
GetPlayerPos(playeridFloat:xFloat:yFloat:z);
    
sInfo[playerid][money] = GetPlayerMoney(playerid);
    
sInfo[playerid][level] = GetPlayerScore(playerid);
    
sInfo[playerid][s_posx] = x;
    
sInfo[playerid][s_posy] = y;
    
sInfo[playerid][s_posz] = z;
    
sInfo[playerid][s_angle] = Angle;
    new 
query[128];
    
format(querysizeof(query), "UPDATE users SET money='%i', level='%i', pos_x='%f', pos_y='%f', pos_z='%f', angle='%f' WHERE id='%i'"sInfo[playerid][money],sInfo[playerid][level],sInfo[playerid][s_posx],sInfo[playerid][s_posx],sInfo[playerid][s_posz],sInfo[playerid][s_angle],sInfo[playerid][db_id]);
    
mysql_function_query(dbhandlequeryfalse"""");
return 
1;

it may be necessary to increase the size.
in format 102 size
in float 32 size
in int +- 20 size
Code:
new query[154];



Re: CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to - akib - 29.03.2018

Quote:
Originally Posted by ForCop
View Post
it may be necessary to increase the size.
in format 102 size
in float 32 size
in int +- 20 size
Code:
new query[154];
Thanks it's working.