jaymc Posted August 10, 2007 Share Posted August 10, 2007 I have a `views` field in my database which stores how many page views Ive had Tp update it I pull out the current value with a SELECT, add++ one to it then UPDATE the new value back in Is there anyway to do this without first pulling out the initial value Perhaps a special field type ? Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted August 10, 2007 Share Posted August 10, 2007 try... UPDATE my_table SET my_column = my_column + 1 WHERE id = $id Quote Link to comment Share on other sites More sharing options...
jaymc Posted August 15, 2007 Author Share Posted August 15, 2007 Excellent Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.