Query error
#1

What may be the problem? I get this:

[14:15:26] CMySQLHandler::Query(UPDATE `vehicles`(Owner, X, Y, Z, Angle,Spa,Spa1,Fuel,Uzr,Apz,Tune0,Tune1,Tune2,Tune 3,Tune4,Tune5,Tune6,Tune7,Tune8,Tune9,Tune10,Tune1 1,Tune12,Tune13) VALUES(liol, 2112.217529, 1402.398559, 11.167914, 217.859771, 12, 42, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) - 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 '(Owner, X, Y, Z, Angle,Spa,Spa,Fuel,Uzr,Apz,Tune0,Tune1,Tune2,T' at line 1)

I use this:

pawn Код:
format(Query, sizeof(Query), "UPDATE `vehicles`\
    (Owner, X, Y, Z, Angle,Spa,Spa1,Fuel,Uzr,Apz,Tune0,Tune1,Tune2,Tune3,Tune4,Tune5,Tune6,Tune7,Tune8,Tune9,Tune10,Tune11,Tune12,Tune13) \
    VALUES(%s, %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)"
,
    vInfo[vehicleid][Owner],
    PositionX,
    PositionY,
    PositionZ,
    AngleZ,
    Color1,
    Color2,
    vInfo[vehicleid][Fuel],
    vInfo[vehicleid][Uzr],
    vInfo[vehicleid][Apz],
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SPOILER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HOOD),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_ROOF),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SIDESKIRT),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_LAMPS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_NITRO),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_EXHAUST),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_WHEELS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_STEREO),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HYDRAULICS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_FRONT_BUMPER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_REAR_BUMPER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_RIGHT),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_LEFT)
    );
Reply
#2

Does it matter if you have 'spa' in there twice?
is your query string long enough?
are you sure the update syntax is correct ( I'm not sure about this )
maybe "UPDATE `database`.`table` SET var='%d', var='%d',... WHERE whatever;"
Reply
#3

You don't need backslash to continue PAWN strings nor mySQL queries onto a new line. And yes, you have put `Spa` twice.
Reply
#4

I edited my post ant tryed with those setting, but still won't work
Reply
#5

Quote:
Originally Posted by ajwar
Посмотреть сообщение
I edited my post ant tryed with those setting, but still won't work
Read my above post.
Reply
#6

Can you show what do you mean in code? I tryed to take away slashes but i got 4 errors, undefined INTO ...........
Reply
#7

pawn Код:
format(Query, sizeof(Query), "UPDATE `vehicles`
    (Owner, X, Y, Z, Angle,Spa,Spa1,Fuel,Uzr,Apz,Tune0,Tune1,Tune2,Tune3,Tune4,Tune5,Tune6,Tune7,Tune8,Tune9,Tune10,Tune11,Tune12,Tune13)
    VALUES(%s, %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)"
,
    vInfo[vehicleid][Owner],
    PositionX,
    PositionY,
    PositionZ,
    AngleZ,
    Color1,
    Color2,
    vInfo[vehicleid][Fuel],
    vInfo[vehicleid][Uzr],
    vInfo[vehicleid][Apz],
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SPOILER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HOOD),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_ROOF),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_SIDESKIRT),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_LAMPS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_NITRO),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_EXHAUST),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_WHEELS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_STEREO),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_HYDRAULICS),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_FRONT_BUMPER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_REAR_BUMPER),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_RIGHT),
    GetVehicleComponentInSlot(vehicleid, CARMODTYPE_VENT_LEFT)
);
[/QUOTE]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)