SA-MP Forums Archive
SQL syntax error? - 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: SQL syntax error? (/showthread.php?tid=444950)



SQL syntax error? - Rokzlive - 19.06.2013

Im getting an error in my syntax but i cant find it.
Error:
Код:
[23:06:10] CMySQLHandler::Query(SELECT * FROM `playervehicles` WHERE `owner`= 'Whatcha' LIMIT 1 DESC) - 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 'DESC' at line 1)
Query:
pawn Код:
format(String,sizeof(String),"SELECT * FROM `playervehicles` WHERE `owner`= '%s' LIMIT 1 DESC",PlayerName(playerid));



Re: SQL syntax error? - Scenario - 19.06.2013

pawn Код:
VALUES ('%s','%i','%s','%f','%f','%f','%f','%i','1','1')
Is not the correct syntax.

pawn Код:
VALUES ('%s',%i,'%s',%f,%f,%f,%f,%i,1,1)
You only need to put apostrophes around the %s placeholder, or more accurately, a string.


Re: SQL syntax error? - Rokzlive - 19.06.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
pawn Код:
VALUES ('%s','%i','%s','%f','%f','%f','%f','%i','1','1')
Is not the correct syntax.

pawn Код:
VALUES ('%s',%i,'%s',%f,%f,%f,%f,%i,1,1)
You only need to put apostrophes around the %s placeholder, or more accurately, a string.
Fixed that error. Now its a different one.


Re: SQL syntax error? - kamzaf - 19.06.2013

whats the point in adding "DESC" when theres only "LIMIT 1" 1 result to show....