PDA

View Full Version : Problem with sql


Tanush123
17/07/2013, 09:16 PM
[21:15:05] CMySQLHandler::Query(UPDATE PlayerDealership SET Lock = 1 WHERE Owner = 'Tan') - 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 'Lock = 1 WHERE Owner = 'Tan'' at line 1)
[21:15:05] >> mysql_query( Connection handle: 1 )
[21:15:05] CMySQLHandler::Query(UPDATE PlayerDealership2 SET Lock = 1 WHERE Owner = 'Tan') - 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 'Lock = 1 WHERE Owner = 'Tan'' at line 1)
[21:15:05] >> mysql_query( Connection handle: 1 )
[21:15:05] CMySQLHandler::Query(UPDATE PlayerDealership3 SET Lock = 1 WHERE Owner = 'Tan') - 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 'Lock = 1 WHERE Owner = 'Tan'' at line 1)
[21:15:05] >> mysql_query( Connection handle: 1 )
[21:15:05] CMySQLHandler::Query(UPDATE PlayerDealership4 SET Lock = 1 WHERE Owner = 'Tan') - 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 'Lock = 1 WHERE Owner = 'Tan'' at line 1)
[21:15:05] >> mysql_query( Connection handle: 1 )
[21:15:05] CMySQLHandler::Query(UPDATE PlayerDealership5 SET Lock = 1 WHERE Owner = 'Tan') - 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 'Lock = 1 WHERE Owner = 'Tan'' at line 1)
[21:15:05] >> mysql_store_result( Connection handle: 1 )

format(str,sizeof(str),"UPDATE PlayerDealership SET Lock = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);
format(str,sizeof(str),"UPDATE PlayerDealership2 SET Lock = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);
format(str,sizeof(str),"UPDATE PlayerDealership3 SET Lock = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);
format(str,sizeof(str),"UPDATE PlayerDealership4 SET Lock = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);
format(str,sizeof(str),"UPDATE PlayerDealership5 SET Lock = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);

gtakillerIV
17/07/2013, 09:36 PM
Try to enclose Owner with backticks (`). `Owner`

[HiC]TheKiller
18/07/2013, 12:20 AM
Enclose the Lock field with back ticks.


format(str,sizeof(str),"UPDATE PlayerDealership SET `Lock` = 1 WHERE Owner = '%s'",Nam);
mysql_query(str);

Pretty sure lock is a MySQL function and therefore it may screw up your query if you don't use backticks.