Mysql Error Syntax
#1

Heey all,

I have an error in my mysql log but i dont know how to fix this.
I only spotted one thing at vMod6.
Whats wrong with my mysql?
My Error:
Code:
[01:07:12] ProcessQueryThread(OnQueryFinish) - Executing query UPDATE `a_vehicles` SET `vCreated` = 2, `vModel` = 602, `vPosx` = -1649.868, `vPosy` = 1218.898, `vPosz` = 7.011, `vPosa` = 224.333, `vColor1` = 1, `vColor2` = 1, `vInterior` = 0, `vVirtualworld` = 0, `vNumberplate` = ACNR, `vValue` = -615000, `vLocked` = 0, `vAlarm` = 0,`vPaintjob` = 255, `vTrunk1` = 0,`vTrunk1a` = 0, `vTrunk2` = 0, `vTrunk2a` = 0,`vTrunk3` = 0,`vTrunk3a` = 0,`vTrunk4` = 0,`vTrunk4a` = 0,`vTrunk5` = 0,`vTrunk5a` = 0,`vMod0` = 0,`vMod1` = 0,`vMod2` = 0,`vMod3` = 0,`vMod4` = 0, `vMod5` = 0,`vMod6` = ,`vMod7` = 0,`vMod8` = 0,`vMod9` = 0,`vMod10` = 0,`vMod11` = 0,`vMod12` = 0,`vMod13` = 0,`vFuel` = 100.000000 WHERE `vVehicleid` = 'v1'...
[01:07:12] ProcessQueryThread(OnQueryFinish) - Error will be triggered to OnQueryError().
My code:
Code:
new query[1024];
	new query2[1024];
	new query3[1024];
	format(query, sizeof(query), "UPDATE `"#MYSQL_VEHICLE_TABLE"` SET `vCreated` = %d, `vModel` = %d, `vPosx` = %.3f, `vPosy` = %.3f, `vPosz` = %.3f, `vPosa` = %.3f, \
	`vColor1` = %d, `vColor2` = %d, `vInterior` = %d, `vVirtualworld` = %d, `vNumberplate` = %s, `vValue` = %d, `vLocked` = %d, `vAlarm` = %d,",
		VehicleCreated[vehicleid],
		VehicleModel[vehicleid],
		VehiclePos[vehicleid][0],
		VehiclePos[vehicleid][1],
		VehiclePos[vehicleid][2],
		VehiclePos[vehicleid][3],
		VehicleColor[vehicleid][0],
		VehicleColor[vehicleid][1],
		VehicleInterior[vehicleid],
		VehicleWorld[vehicleid],
		VehicleNumberPlate[vehicleid],
		VehicleValue[vehicleid],
		VehicleLock[vehicleid],
		VehicleAlarm[vehicleid]);
	format(query2, sizeof(query2), "`vPaintjob` = %d, `vTrunk1` = %d,`vTrunk1a` = %d, `vTrunk2` = %d, `vTrunk2a` = %d,`vTrunk3` = %d,`vTrunk3a` = %d,`vTrunk4` = %d,\
	`vTrunk4a` = %d,`vTrunk5` = %d,`vTrunk5a` = %d,`vMod0` = %d,`vMod1` = %d,`vMod2` = %d,`vMod3` = %d,`vMod4` = %d,`vMod5` = %d,`vMod6` = %d,",
		VehiclePaintjob[vehicleid],
		VehicleTrunk[vehicleid][0][0],
		VehicleTrunk[vehicleid][0][1],
		VehicleTrunk[vehicleid][1][0],
		VehicleTrunk[vehicleid][1][1],
		VehicleTrunk[vehicleid][2][0],
		VehicleTrunk[vehicleid][2][1],
		VehicleTrunk[vehicleid][3][0],
		VehicleTrunk[vehicleid][3][1],
		VehicleTrunk[vehicleid][4][0],
		VehicleTrunk[vehicleid][4][1],
		VehicleMods[vehicleid][1],
		VehicleMods[vehicleid][2],
		VehicleMods[vehicleid][3],
		VehicleMods[vehicleid][4],
		VehicleMods[vehicleid][5],
		VehicleMods[vehicleid][6]);
	format(query3, sizeof(query3), "`vMod7` = %d,`vMod8` = %d,`vMod9` = %d,`vMod10` = %d,`vMod11` = %d,`vMod12` = %d,`vMod13` = %d,\
	`vFuel` = %f WHERE `vVehicleid` = 'v%d'",
		VehicleMods[vehicleid][7],
		VehicleMods[vehicleid][8],
		VehicleMods[vehicleid][9],
		VehicleMods[vehicleid][10],
		VehicleMods[vehicleid][11],
		VehicleMods[vehicleid][12],
		VehicleMods[vehicleid][13],
		Fuel[vehicleid],
		vehicleid);
	format(query,sizeof(query),"%s%s%s",query,query2,query3);
How to fix this error?

Admigo
Reply
#2

You don't need to use a grave (`) around each value you are setting in the query. I would suggest looking at some MySQL tutorials.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)