SA-MP Forums Archive
Don't understand what's wrong with this mysql 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)
+--- Thread: Don't understand what's wrong with this mysql query. (/showthread.php?tid=579991)



Don't understand what's wrong with this mysql query. - Dokins - 01.07.2015

pawn Код:
new query[550];
        format(query, sizeof(query), "UPDATE `vehicles` SET VehFType = %d, VehSpark = %d, VehBrake = %d, VehGear = %d, VehElec = %d, VehWater = %d, VehOil = %d, VehExhaust = %d, VehFLine = %d, VehRadi = %d, VehFSize = %d, VehFUsed = %d, VehBattery = %d WHERE id = %d LIMIT 1" ,VehFType[vehicleid], VehSpark[vehicleid], VehBrake[vehicleid], VehGear[vehicleid], VehElec[vehicleid],
        VehWater[vehicleid], VehOil[vehicleid], VehExhaust[vehicleid], VehRadi[vehicleid], VehFLine[vehicleid], VehFSize[vehicleid], VehFUsed[vehicleid], VehBattery[vehicleid], VehFSize[vehicleid], VehicleSQLID[vehicleid]);
        mysql_query(query);
Title says all, it just doesn't update anything or return anything in the console.


Re: Don't understand what's wrong with this mysql query. - Sawalha - 01.07.2015

check mysql_log.txt, maybe there's an error / a warning


Re: Don't understand what's wrong with this mysql query. - Dokins - 01.07.2015

I'll have to run the debug.


Re: Don't understand what's wrong with this mysql query. - Suicidal.Banana - 01.07.2015

for starters remove LIMIT 1, there should already be only 1 record since your selecting it by id, which should be unique.

Secondly VehRadi[vehicleid] & VehFLine[vehicleid] need to swap places in the list of arguments to match the field/colum-names of the query

Finally VehFSize[vehicleid] is featured twice in the list of arguments, in effect setting the 'double' of the id at the end of the query too VehFSize[vehicleid], totally screwing over the query, and you actually have 1 argument more then you have placeholders (the %d stuff) so remove the VehFSize[vehicleid] after VehBattery[vehicleid] to resolve.


Re: Don't understand what's wrong with this mysql query. - Dokins - 01.07.2015

Thanks a lot, I've resolved this!


Re: Don't understand what's wrong with this mysql query. - Suicidal.Banana - 01.07.2015

always a pleasure