#1

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.. :/
Reply
#2

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);
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)