SA-MP Forums Archive
MySQL Syntax - 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 Syntax (/showthread.php?tid=467864)



MySQL Syntax - MrMou6 - 05.10.2013

Hello, maybye someone know what is wrong with this line:
Code:
"SELECT * FROM 'cars' WHERE savininkas = '%s', kiekis = '1' LIMIT 1"
In mysql_log.txt i get this error:
Code:
CMySQLHandler::Query(SELECT * FROM 'cars' WHERE savininkas = 'Cristiano_Fernandes', kiekis = '1' LIMIT 1) - 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 ''cars' WHERE savininkas = 'Cristiano_Fernandes', kiekis = '1' LIMIT 1' at line 1)



Re: MySQL Syntax - QuaTTrO - 05.10.2013

Code:
"SELECT * FROM cars WHERE savininkas = '%s', kiekis = '1' LIMIT 1"
You specify table name without ' '


Re: MySQL Syntax - Dragonsaurus - 05.10.2013

Maybe should be:
pawn Code:
"SELECT * FROM cars WHERE savininkas = '%s' AND kiekis = 1 LIMIT 1"
Also do not forget to see what QuaTTro said.