SA-MP Forums Archive
Error in your SQL syntax? All is correct. - 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: Error in your SQL syntax? All is correct. (/showthread.php?tid=504897)



Error in your SQL syntax? All is correct. - Dokins - 06.04.2014

pawn Код:
[08:08:45] CMySQLHandler::Query(INSERT INTO `weapons` (WepModel, WepAmmo, WepOwner,WepSerial, WepX, WepY, WepZ, WepEvi, WepDate, WepVW, WepInt) VALUES (30, 250) - 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 '' at line 1)

pawn Код:
format(query, sizeof(query), "INSERT INTO `weapons` (WepModel, WepAmmo, WepOwner, WepSerial, WepX, WepY, WepZ, WepEvi, WepDate, WepVW, WepInt) VALUES (%d,250,0,0,0,0,0,0,0,0,0)",WepID[playerid]);
            mysql_query(query);
            new id = mysql_insert_id();



Re: Error in your SQL syntax? All is correct. - VishvaJeet - 06.04.2014

Код:
format(query, sizeof(query), "INSERT INTO `weapons` (WepModel, WepAmmo, WepOwner, WepSerial, WepX, WepY, WepZ, WepEvi, WepDate, WepVW, WepInt) VALUES ('%d', '250', '0', '0', '0' ,'0' ,'0', '0' ,'0', '0', '0')",WepID[playerid]);
            mysql_query(query);
            new id = mysql_insert_id();



Re: Error in your SQL syntax? All is correct. - Dubya - 06.04.2014

the length of the variable 'query' is too small. try increasing it to 256, or larger if neccessarry.


Re: Error in your SQL syntax? All is correct. - Dokins - 06.04.2014

That's not the issue, I use it elsewhere without the ' '!

EDIT: Thanks to the Poster Above.