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

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;

Reply
#2

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

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).
Reply
#4

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
Reply
#5

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];
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)