Mysql - Error ID: 1064
#1

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

Try

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)