SA-MP Forums Archive
mysql - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql (/showthread.php?tid=256339)



mysql - BaubaS - 20.05.2011

Hello all, so I have a question about mysql..

I want to update a field like in variables:

something += 5;

because if the field value set to 7, and I want to update +5(7+5=12) and do:

format(something, value, "UPDATE `table` SET `field` = '5' WHERE `something` = '%s'", something); it will set value to 5.. :/


Re: mysql - DeathOnaStick - 20.05.2011

Quote:
Originally Posted by BaubaS
Посмотреть сообщение
Hello all, so I have a question about mysql..

I want to update a field like in variables:

something += 5;

because if the field value set to 7, and I want to update +5(7+5=12) and do:

format(something, value, "UPDATE `table` SET `field` = '5' WHERE `something` = '%s'", something); it will set value to 5.. :/
You first need to get the number that is in the table (7). Then you add the variable you stored the 7 in with 5.
Something like that will come out:

pawn Код:
format(something, value, "UPDATE `table` SET `field` = '%i' WHERE `something` = '%s'",VariableThatStoresTheSumOfSevenPlusFive, something);



Re: mysql - BaubaS - 20.05.2011

Im not drunk, I would use variables in end of 'format', but Im asking if the player is offline.