[16:44:56] [ERROR] error #1064 while executing query "INSERT INTO `Vehicles` (`ID`, `Owner`, `Price`, `X`, `Y`, `Z`, `A`, `VirtualWorld`, `Interior`, `Locked`, `Model`, `Color1`, `Color2`, `Plate` VALUES ('Lа0\nlзеb', '68', '0.000000', '787.998352', '326.729553', '19.882813', '1133200873', '0', '0', '0', '522', '0', 'еb": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VALUES ('Lа0\nlзеb', '68', '0.000000', '787.998352', '326.729553', '19.88281' at line 1
enum eVehicleData { VehicleID, ModelID, Color[2], Float:Position[4], Paintjob, Part[14], Owner[21], Plate[9], Locked, Text3D:Label, VirtualWorld, Interior, Price }; CreateVehicleEx(modelid, owner[], price, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, interior, virtualworld, color1, color2, siren = 0) { new id = Iter_Free(Vehicles); VehicleData[id][VehicleID] = CreateVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2, -1, siren); _Veh[VehicleData[id][VehicleID]] = id; VehicleData[id][ModelID] = modelid; VehicleData[id][Color][0] = color1; VehicleData[id][Color][1] = color2; VehicleData[id][Paintjob] = -1; VehicleData[id][Position][0] = spawn_x; VehicleData[id][Position][1] = spawn_y; VehicleData[id][Position][2] = spawn_z; VehicleData[id][Locked] = 0; VehicleData[id][Position][3] = z_angle; VehicleData[id][Interior] = interior; VehicleData[id][VirtualWorld] = virtualworld; format(VehicleData[id][Owner], 21, owner); VehicleData[id][Price] = price; for(new x = 0; x < 25; x++) { format(VehicleData[id][Plate], 8, "%s%s%s-%d%d%d", LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], random(10), random(10), random(10)); } SetVehicleNumberPlate(VehicleData[id][VehicleID], VehicleData[id][Plate]); SetVehicleToRespawn(VehicleData[id][VehicleID]); Iter_Add(Vehicles, id); new DB_Query[4096]; mysql_format(MySQL_Database, DB_Query, sizeof(DB_Query), "INSERT INTO `Vehicles` (`ID`, `Owner`, `Price`, `X`, `Y`, `Z`, `A`, `VirtualWorld`, `Interior`, `Locked`, `Model`, \ `Color1`, `Color2`, `Plate` VALUES ('%e', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d', '%d', '%d', '%d', '%s')", id, VehicleData[id][Owner], VehicleData[id][Price], VehicleData[id][Position][0], \ VehicleData[id][Position][1], VehicleData[id][Position][2], VehicleData[id][Position][3], VehicleData[id][VirtualWorld], VehicleData[id][Interior], VehicleData[id][Locked], VehicleData[id][ModelID], \ VehicleData[id][Color][0], VehicleData[id][Color][1], VehicleData[id][Plate]); mysql_query(MySQL_Database, DB_Query); LinkVehicleToInterior(VehicleData[id][VehicleID], interior); SetVehicleVirtualWorld(VehicleData[id][VehicleID], virtualworld); if(!strlen(VehicleData[id][Owner]) || !strcmp(VehicleData[id][Owner], "Dealership")) { new str[150]; format(str, sizeof(str), "Free VEHICLE"); VehicleData[id][Label] = Create3DTextLabel(str, 0x008080FF, 0.0, 0.0, 0.0, 50.0, 0); Attach3DTextLabelToVehicle(VehicleData[id][Label], VehicleData[id][VehicleID], 0.0, 0.0, 1.0); } return VehicleData[id][VehicleID]; }
"CREATE TABLE IF NOT EXISTS `Vehicles` (\ `ID` int(11),\ `Owner` varchar(48) default '',\ `Price` int(11) default '0',\ `X` float default '0',\ `Y` float default '0',\ `Z` float default '0',\ `A` float default '0',\ `VirtualWorld` int(11) default '0',\ `Interior` int(11) default '0',\ `Locked` int(1) default '0',\ `Model` int(5) default '0',\ `Color1` int(5) default '0',\ `Color2` int(5) default '0',\ `Plate` varchar(8),\ `PJ` int(5) default '-1',"
VALUES ('%e', %d, %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, '%s')
OMG how could I forgot the ' LOL
thanks so much lmao I've been confused where was I going wrong also should I use %e wherever I use string? Because I used it mainly for the account name and salt etc |
yes in mysql format you should always use %e to format a string. that'll escape the string before inserting it, read more here if you're interested
|
[ERROR] error #1064 while executing query "INSERT INTO `Vehicles` (`ID`, `Owner`, `Price`, `X`, `Y`, `Z`, `A`, `VirtualWorld`, `Interior`, `Locked`, `Model`, `Color1`, `Color2`, `Plate` VALUES (1, 'Dealership', 693, 789.164246, 329.086884, 19.882813, 117.491119, 0, 0, 0, 562, 52, 25, 'ZOK-485')": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VALUES (1, 'Dealership', 693, 789.164246, 329.086884, 19.882813, 117.491119, 0, ' at line 1
mysql_format(MySQL_Database, DB_Query, sizeof(DB_Query), "INSERT INTO `Vehicles` (`ID`, `Owner`, `Price`, `X`, `Y`, `Z`, `A`, `VirtualWorld`, `Interior`, `Locked`, `Model`, \ `Color1`, `Color2`, `Plate` VALUES (%d, '%e', %d, %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, '%e')", id, VehicleData[id][Owner], VehicleData[id][Price], VehicleData[id][Position][0], \ VehicleData[id][Position][1], VehicleData[id][Position][2], VehicleData[id][Position][3], VehicleData[id][VirtualWorld], VehicleData[id][Interior], VehicleData[id][Locked], VehicleData[id][ModelID], \ VehicleData[id][Color][0], VehicleData[id][Color][1], VehicleData[id][Plate]);