Error in Query? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Error in Query? (
/showthread.php?tid=210394)
Error in Query? -
Antonio [G-RP] - 12.01.2011
When I do /vehpos to save the vehicles position, I get this.
Код:
[16:42:06] 1|562|1764.76|-1854.28|13.4141|285.53|3|3|6000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
[16:42:06] Number of vehicle models: 1
[16:43:22] MySQL Error (0): Could not execute query. 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 'WHERE `VEHid` = '1'' at line 1.
This is under UpdateVehicleInfo()
pawn Код:
format(string, sizeof(string), "UPDATE `vehicles` SET `VEHid` = '%d', `model` = '%d', `park_x` = '%f', `park_y` = '%f', `park_z` = '%f', `park_o` = '%f' WHERE \
`VEHid` = '%d'", VehicleInfo[vehicleid][vVEHid], VehicleInfo[vehicleid][vModel], \
VehicleInfo[vehicleid][vPark_x], VehicleInfo[vehicleid][vPark_y], VehicleInfo[vehicleid][vPark_z], VehicleInfo[vehicleid][vPark_o], VehicleInfo[vehicleid][vVEHid]);
mysql_query(string);
Re: Error in Query? -
Anthonyx3' - 12.01.2011
Quote:
Originally Posted by Antonio [G-RP]
When I do /vehpos to save the vehicles position, I get this.
pawn Код:
format(string, sizeof(string), "UPDATE `vehicles` SET `VEHid` = %d, `model` = %d, `park_x` = %f, `park_y` = %f, `park_z` = %f, `park_o` = %f WHERE \ `VEHid` = %d", VehicleInfo[vehicleid][vVEHid], VehicleInfo[vehicleid][vModel], \ VehicleInfo[vehicleid][vPark_x], VehicleInfo[vehicleid][vPark_y], VehicleInfo[vehicleid][vPark_z], VehicleInfo[vehicleid][vPark_o], VehicleInfo[vehicleid][vVEHid]); mysql_query(string);
|
Dont add ' ' to anything except strings, '%s'. Not sure if thats your problem, just fixing up your code a tad bit
Re: Error in Query? -
Antonio [G-RP] - 12.01.2011
Adding ` ` and ' ' won't make any difference.
Re: Error in Query? -
coole210 - 13.01.2011
It will make a difference, I fixed my friends' script up just by adding the ` ` and ' ' .
Try it.
Re: Error in Query? -
PeteShag - 13.01.2011
pawn Код:
format(string, sizeof(string), "UPDATE vehicles SET VEHid = '%d', model` = '%d', park_x = '%f', park_y = '%f', park_z = '%f', \
park_o = '%f' WHERE VEHid = '%d'",
VehicleInfo[vehicleid][vVEHid], VehicleInfo[vehicleid][vModel], VehicleInfo[vehicleid][vPark_x], VehicleInfo[vehicleid][vPark_y],
VehicleInfo[vehicleid][vPark_z], VehicleInfo[vehicleid][vPark_o], VehicleInfo[vehicleid][vVEHid]);
mysql_query(string);