MySQL - Log error #1064
#1

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(playeridreason)
{
    if(
LoggedIn[playerid] == 1)
    {
        new 
Query[256];
        
        
mysql_format(mysqlQuerysizeof(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(mysqlQuery"""");
        
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
Reply
#2

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

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?
Reply
#4

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

no since you call to your script the correct database.show us your mysql log again
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)