Jump to content


Photo

Changing values in tables


  • Please log in to reply
1 reply to this topic

#1 Fira

Fira
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 25 September 2006 - 08:40 AM

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

UPDATE user SET variable1 = '15', variable2 = '60' WHERE userid = '$userid'";


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?

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 25 September 2006 - 01:34 PM

SET variable2 = variable2 + 5
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users