PDA

View Full Version : Error in your SQL syntax? All is correct.


Dokins
06/04/2014, 07:10 AM
[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)




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();

VishvaJeet
06/04/2014, 07:15 AM
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();

Dubya
06/04/2014, 07:17 AM
the length of the variable 'query' is too small. try increasing it to 256, or larger if neccessarry.

Dokins
06/04/2014, 07:17 AM
That's not the issue, I use it elsewhere without the ' '!

EDIT: Thanks to the Poster Above.