SA-MP Forums Archive
Problem with sql - 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: Problem with sql (/showthread.php?tid=451604)



Problem with sql - Tanush123 - 17.07.2013

Код:
[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 )
pawn Код:
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);



Re: Problem with sql - gtakillerIV - 17.07.2013

Try to enclose Owner with backticks (`). `Owner`


Re: Problem with sql - [HiC]TheKiller - 18.07.2013

Enclose the Lock field with back ticks.

pawn Код:
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.