MySQL debug error
#1

Код HTML:
[20:09:35] CMySQLHandler::Query(2015-04-24 20:09INSERT INTO `vehicles2` (Transportas, Model, Pos_X, Pos_Y, Pos_Z, Pos_A, Rida, Fuel, FuelType, Color1, Color2, Paintjob, Tune0, Tune1, Tune2, Tune3, Tune4, Tune5, Tune6, Tune7, Tune8, Tune9, Tune10, Tune11, Tune12, Locked, NumberPlate, Sprogusi, Data, Kaina, vSanaudos, vBakas) VALUES ('Twinkle_Toes', '411', '2224.350830', '-49.050498', '26.335899', '90.854103', '0.000000', '22.399999', '1', '62', '96', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'Neregistruota', '0', '2015-04-24 20:09', '235000', '1.100000', '149.500000'))
- 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 '2015-04-24 20:09INSERT INTO `vehicles2` (Transportas, Model, Pos_X, Pos_Y, Pos_Z' at line 1)
Код:
format(Query, sizeof(Query), "INSERT INTO `vehicles2` (Transportas, Model, Pos_X, Pos_Y, Pos_Z, Pos_A, Rida, Fuel, FuelType, Color1, Color2, Paintjob, Tune0, Tune1, Tune2, Tune3, Tune4, Tune5, Tune6, Tune7, Tune8, Tune9, Tune10, Tune11, Tune12, Locked, NumberPlate, Sprogusi, Data, Kaina, vSanaudos, vBakas) ");
strcat(String, Query);

format(Query, sizeof(Query), "VALUES ('%s', '%d', '%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%d', '%s', '%d', '%f', '%f')",

GetPlayerNameEx(playerid),
GetVehicleModel(vehicleid),
vPos[0],
vPos[1],
vPos[2],
vPos[3],
VehicleInfo[vehicleid][vRida],
VehicleInfo[vehicleid][vKuras],
VehicleInfo[vehicleid][vKuroTipas],
VehicleInfo[vehicleid][vColor][0],
VehicleInfo[vehicleid][vColor][1],
VehicleInfo[vehicleid][vPaintJob],
GetVehicleComponentInSlot(vehicleid, 0),
GetVehicleComponentInSlot(vehicleid, 1),
GetVehicleComponentInSlot(vehicleid, 2),
GetVehicleComponentInSlot(vehicleid, 3),
GetVehicleComponentInSlot(vehicleid, 4),
GetVehicleComponentInSlot(vehicleid, 5),
GetVehicleComponentInSlot(vehicleid, 6),
GetVehicleComponentInSlot(vehicleid, 7),
GetVehicleComponentInSlot(vehicleid, 8),
GetVehicleComponentInSlot(vehicleid, 9),
GetVehicleComponentInSlot(vehicleid, 10),
GetVehicleComponentInSlot(vehicleid, 11),
GetVehicleComponentInSlot(vehicleid, 12),
VehicleInfo[vehicleid][vUzraktas],
VehicleInfo[vehicleid][vNumeriai],
VehicleInfo[vehicleid][vSprogusi],
VehicleInfo[vehicleid][vKadaNupirktas],
VehicleInfo[vehicleid][vKaina],
VehicleInfo[vehicleid][vSanaudos],
VehicleInfo[vehicleid][vBakas]);

strcat 		(String, Query);
mysql_query	(String);
Reply
#2

You didn't clear "String" before and it has a date right before the actual query.
pawn Код:
String[0] = EOS;
format(Query, sizeof(Query), "INSERT INTO `vehicles2` (Transportas, Model, Pos_X, Pos_Y, Pos_Z, Pos_A, Rida, Fuel, FuelType, Color1, Color2, Paintjob, Tune0, Tune1, Tune2, Tune3, Tune4, Tune5, Tune6, Tune7, Tune8, Tune9, Tune10, Tune11, Tune12, Locked, NumberPlate, Sprogusi, Data, Kaina, vSanaudos, vBakas) ");
strcat(String, Query);
Reply
#3

Thanks a lot.
Reply
#4

If you want to avoid stuff like that in the future, grab this:
pawn Код:
#define strcpy(%0,%1) \
    strcat((%0[0] = '\0', %0), %1)
If you are using pawno and want function hint, add this:
pawn Код:
/*
native strcpy(dest[], const source[], maxlength=sizeof dest);
*/
Reply


Forum Jump:


Users browsing this thread: