SA-MP Forums Archive
Mysql - Error ID: 1064 - 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: Mysql - Error ID: 1064 (/showthread.php?tid=285432)



Mysql - Error ID: 1064 - Rider13 - 24.09.2011

------------------ Debug ----------------------
Код:
[09:12:37] CMySQLHandler::Query(INSERT INTO `players` (sqlid,Nimi,Key) VALUES ('0','Random_Name','loll')) - An error has occured. (Error ID: 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 'Key) VALUES ('0','Random_Name','loll')' at line 1)

[09:12:37] CMySQLHandler::Query(SELECT * FROM `players` WHERE Nimi = 'Random_Name' AND Key = 'loll') - An error has occured. (Error ID: 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 'Key = 'loll'' at line 1)

[09:12:39] CMySQLHandler::Query(UPDATE players SET Key='',AdminLevel='0',Money='0' WHERE Nimi='Random_Name') - An error has occured. (Error ID: 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 'Key='',AdminLevel='0',Money='0' WHERE Nimi='Random_Name'' at line 1)
------------- Script -------------------------

Код:
format(string, sizeof(string), "INSERT INTO `players` (sqlid,Nimi,Key) VALUES ('0','%s','%s')", PlayerInfo[playerid][pPName], password);
mysql_query(string);
print(string);

format(string, sizeof(string), "SELECT * FROM `players` WHERE Nimi = '%s' AND Key = '%s'", PlayerInfo[playerid][pPName], password);
mysql_query(string);

format(string, sizeof(string), "UPDATE players SET Key='%s',AdminLevel='%d',Money='%d' WHERE Nimi='%s'", PlayerInfo[playerid][pKey], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pPName]);
mysql_query(string);
Any help for fixing this error ?


Re: Mysql - Error ID: 1064 - Pinguinn - 24.09.2011

Try

pawn Код:
format(string, sizeof(string), "INSERT INTO `players` VALUES ('0','%s','%s')", PlayerInfo[playerid][pPName], password);
mysql_query(string);



Re: Mysql - Error ID: 1064 - Xyrex - 24.09.2011

That is because you cant use the word "Key" as a field of your DB.

Change "Key" to "Pass", or another word (I use "Keyp", for example) and your problem will be solved.


Re: Mysql - Error ID: 1064 - Rider13 - 24.09.2011

Quote:
Originally Posted by Xyrex
Посмотреть сообщение
That is because you cant use the word "Key" as a field of your DB.

Change "Key" to "Pass", or another word (I use "Keyp", for example) and your problem will be solved.
Thanks, Problem solved.