21.09.2012, 19:33
Hello there,
I have modified my SaveOwnedCar stock, in order to allow proper updating of database records (previously it updated all fields and made them to 0 or default for some reason, and I'm hoping this way it will only update the selected fields), but somehow I get this weird syntax issue pop up on the console, when I start the server up. I have no idea where I'm going wrong.
The syntax message is this...
But I've also printed this...
I have modified my SaveOwnedCar stock, in order to allow proper updating of database records (previously it updated all fields and made them to 0 or default for some reason, and I'm hoping this way it will only update the selected fields), but somehow I get this weird syntax issue pop up on the console, when I start the server up. I have no idea where I'm going wrong.
Код:
stock SaveOwnedCar(iVehicleID) { new Query[1024], buffer[160], SQL_vOwner[MAX_PLAYER_NAME], SQL_VehiclePlate[32]; mysql_real_escape_string(Vehicles[iVehicleID][VehicleOwner], SQL_vOwner); mysql_real_escape_string(Vehicles[iVehicleID][VehiclePlate], SQL_VehiclePlate); format(Query, sizeof(Query), "UPDATE `OwnedVehicles` SET `OwnedVehicleModel` = %i, `OwnedVehicleColor1` = %i, `OwnedVehicleColor2` = %i, `OwnedVehiclePrice` = %i, `OwnedVehicleOwner` = '%s', ", Vehicles[iVehicleID][vModel], Vehicles[iVehicleID][vColor1], Vehicles[iVehicleID][vColor2], Vehicles[iVehicleID][vPrice], SQL_vOwner); format(buffer, sizeof(buffer), "`OwnedVehicleX` = '%0.3f', `OwnedVehicleY` = '%0.3f', `OwnedVehicleZ` = '%0.3f', `OwnedVehicleA` = '%0.3f', `OwnedVehiclePlate` = '%s', ", Vehicles[iVehicleID][vPosX], Vehicles[iVehicleID][vPosY], Vehicles[iVehicleID][vPosZ], Vehicles[iVehicleID][vPosA], SQL_VehiclePlate); strcat(Query, buffer); format(buffer, sizeof(buffer), "`OwnedVehiclePaintJob` = %i, `OwnedVehicleLock` = %i, `OwnedVehicleMoney` = %i, `OwnedVehicleMaterials` = %i, `OwnedVehicleCocaine` = %i, ", Vehicles[iVehicleID][VehiclePaintJob], Vehicles[iVehicleID][vLocked], Vehicles[iVehicleID][vTrunkMoney], Vehicles[iVehicleID][vTrunkMats], Vehicles[iVehicleID][vTrunkCocaine]); strcat(Query, buffer); format(buffer, sizeof(buffer), "`OwnedVehicleMoonshine` = %i, `OwnedVehicleWeed` = %i,`OwnedVehicleFuel` = %d WHERE `OwnedVehicleID` = %i LIMIT", Vehicles[iVehicleID][vTrunkMoonshine], Vehicles[iVehicleID][vTrunkWeed], Vehicles[iVehicleID][vFuel], iVehicleID); strcat(Query, buffer); print(Query); mysql_query(Query); return 1; }
Код:
[20:27:27] 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 '' at line 1 -1 -1 NULL UPDATE `OwnedVehicles` SET `OwnedVehicleModel` = 451, `OwnedVehicleColor1` = 3, `OwnedVehicleColor2` = 3, `OwnedVehiclePrice` = 0, `OwnedVehicleOwner` = 'HighFlyer', `OwnedVehicleX` = '1643.530', `OwnedVehicleY` = '180.645', `OwnedVehicleZ` = '32.897', `OwnedVehicleA` = '348.498', `OwnedVehiclePlate` = 'ZZ57 OPP', `OwnedVehiclePaintJob` = 0, `OwnedVehicleLock` = 0, `OwnedVehicleMoney` = 0, `OwnedVehicleMaterials` = 0, `OwnedVehicleCocaine` = 0, `OwnedVehicleMoonshine` = 0, `OwnedVehicleWeed` = 0,`OwnedVehicleFuel` = 0 WHERE `OwnedVehicleID` = 2 LIMIT 1
Код:
[20:27:27] UPDATE `OwnedVehicles` SET `OwnedVehicleModel` = 451, `OwnedVehicleColor1` = 3, `OwnedVehicleColor2` = 3, `OwnedVehiclePrice` = 0, `OwnedVehicleOwner` = 'HighFlyer', `OwnedVehicleX` = '1643.530', `OwnedVehicleY` = '180.645', `OwnedVehicleZ` = '32.897', `OwnedVehicleA` = '348.498', `OwnedVehiclePlate` = 'ZZ57 OPP', `OwnedVehiclePaintJob` = 0, `OwnedVehicleLock` = 0, `OwnedVehicleMoney` = 0, `OwnedVehicleMaterials` = 0, `OwnedVehicleCocaine` = 0, `OwnedVehicleMoonshine` = 0, `OwnedVehicleWeed` = 0,`OwnedVehicleFuel` = 0 WHERE `OwnedVehicleID` = 2 LIMIT