Error in Query?
#1

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);
Reply
#2

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
Reply
#3

Adding ` ` and ' ' won't make any difference.
Reply
#4

It will make a difference, I fixed my friends' script up just by adding the ` ` and ' ' .

Try it.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)