galvin Posted November 13, 2011 Share Posted November 13, 2011 I have code that I want to increase a column in my products table by 1. So far I have this for my query... $sql = "UPDATE products SET orderclicks = (??????) WHERE productid= '$productid'"; I just need help with that part in question marks. In plain english, it would say "SET orderclicks = orderclicks+1" I tried that and it didn't work. I could easily run a query to get the value of 'orderclicks' first and then add one to that and then run another query to update it to the new value, but I imagine there is a way to do it in just ONE query, so it's more efficient Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 13, 2011 Share Posted November 13, 2011 That's correct - In plain english, it would say "SET orderclicks = orderclicks+1" If you tried that and it did not work, you would need to show the code necessary to reproduce the problem for anyone here to help with why it did not work. Edit: And define ''it didn't work". What did happen? A blank page? A php error? A mysql error? 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.