Jump to content

Archived

This topic is now archived and is closed to further replies.

Fira

Changing values in tables

Recommended Posts

How do you change the values of variables? I know one method would be

[quote]
UPDATE user SET variable1 = '15', variable2 = '60' WHERE userid = '$userid'";
[/quote]

But what if I wanted to add 5 to variable2? Would I need to first retrieve variable2, add 5 to it, then set the new value to variable2, or is there an easier MySQL command, like UPDATE user ADD?

Share this post


Link to post
Share on other sites
SET variable2 = variable2 + 5

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.