MySQL - Log error #1064 -
Saize - 09.02.2015
Hey guys,
Iґm still testing a bit around with MySQL (BlueGґs Plugin), and the accounts just dont save
So I checked the MySQL Log and I got the following error
Quote:
[06:03:45] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ID=''' at line 1
|
And here is the Code
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
if(LoggedIn[playerid] == 1)
{
new Query[256];
mysql_format(mysql, Query, sizeof(Query), "UPDATE accounts SET Skin='%d', Admin='%d', Score='%d', Kills='%d', Deaths='%d', WHERE ID='%d'",
pInfo[playerid][Skin],pInfo[playerid][Admin],pInfo[playerid][Score],pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][ID]);
mysql_tquery(mysql, Query, "", "");
LoggedIn[playerid] = 0;
return 1;
}
return 1;
}
It didnt shown any error or warning while compiling, but I couldnt figure out what Iґve done wrong
Re: MySQL - Log error #1064 -
HazardouS - 09.02.2015
You have an extra comma (,) right before "WHERE". Delete it and try again. This is how it should look:
pawn Код:
mysql_format(mysql, Query, sizeof(Query), "UPDATE accounts SET Skin='%d', Admin='%d', Score='%d', Kills='%d', Deaths='%d' WHERE ID='%d'",
pInfo[playerid][Skin],pInfo[playerid][Admin],pInfo[playerid][Score],pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][ID]);
AW: MySQL - Log error #1064 -
Saize - 09.02.2015
Works fine, but the accounts still doesnt get saved, I just copied it from another GM that I was testing MySQL on and changed some variables + Iґve created a new DB for sure.
Could the problem be that there is a table in another DB with the same name?
Re: MySQL - Log error #1064 -
HazardouS - 09.02.2015
When you're connecting to mysql (mysql_connect), you are selecting the DB too, so other tables in other DBs don't matter. Your query is fine, if it's still not working I can't tell you what the problem is. Maybe the variables ...
Re: MySQL - Log error #1064 -
vassilis - 09.02.2015
no since you call to your script the correct database.show us your mysql log again
AW: Re: MySQL - Log error #1064 -
Saize - 09.02.2015
Quote:
Originally Posted by vassilis
no since you call to your script the correct database.show us your mysql log again
|
Well there is nothing new in the Log and thats what Iґm wondering myself about.
I just made it the same way I did in the other script, and there it all works fine