if (strcmp("/createveh", cmdtext, true, 10) == 0) { new Float:x, Float:y, Float:z, Float:angle; new veh; veh = GetPlayerVehicleID(playerid); GetVehiclePos(veh, x, y, z); GetVehicleZAngle(veh, angle); new Query[200]; format(Query, sizeof(Query), "INSERT INTO `vehicles` (`ID`, `model`, `owner`, `price`, `vehx`, `vehy`, `vehz`, `plate`, `color1`, `color2`, `angle`) VALUES '', '%i', '', '', '%f', '%f', '%f', '', '1', '1', '%f'", veh, x, y, z, angle); mysql_query(Query); return 1; }
mysql_debug(1);
[12:44:24] [12:44:24] --------------------------- [12:44:24] MySQL Debugging activated (07/02/11) [12:44:24] --------------------------- [12:44:24] [12:44:24] >> mysql_connect( ) [12:44:24] CMySQLHandler::CMySQLHandler() - constructor called. [12:44:24] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "sampdb" | Username: "root" ... [12:44:24] CMySQLHandler::Connect() - Connection was successful. [12:44:24] CMySQLHandler::Connect() - Auto-Reconnect has been enabled. [12:45:18] >> mysql_query( Connection handle: 1 ) [12:45:18] CMySQLHandler::Query(INSERT INTO `vehicles` (`ID`, `model`, `owner`, `price`, `vehx`, `vehy`, `vehz`, `plate`, `color1`, `color2`, `angle`) VALUES '', '1', '', '', '2037.928710', '1319.118530', '10.424090', '', '1', '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 ''', '1', '', '', '2037.928710', '1319.118530', '10.424090', '', '1', '1',' at line 1)
format(Query, sizeof(Query), "INSERT INTO `vehicles` (`ID`, `model`, `owner`, `price`, `vehx`, `vehy`, `vehz`, `plate`, `color1`, `color2`, `angle`) VALUES ('', '%i', '', '', '%f', '%f', '%f', '', '1', '1', '%f')", veh, x, y, z, angle);
Values need brackets around them aswell.
pawn Код:
|