Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Increment DB Column Value using HTML Form

Status
Not open for further replies.

WilliamMute007

Programmer
Sep 30, 2007
116
GB
Hi,

Me again.. :( can anyone please advice how I can increment the value in my DB table. Say for example, increase the number of users in a DB table by 2 so if number of user was 100 before, it will now be 102. (using a HTML form)

CODE
("UPDATE tablename SET column = column ++ 2 WHERE column ID = $var"); ???

And where I need to update multiple columns how can I go about that? Say increment column 1 +1 Column 2 + 1 Column 3 + 1 etc...


Would it be something like that?


Thanks in advance
 
That's almost exactly right; have you tried it?
[tt]
UPDATE tablename
SET
col1=col1+1,
col2=col2+1
WHERE id=1234
[/tt]
 
Thanks Tony.. I havent tried it yet but will do at some point this evening. Am just thinking ahead of myself. Thanks tho. Will let you know if it works!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top