marmite Posted April 20, 2007 Share Posted April 20, 2007 It seems that I can't use MAX in this way in SQL. However, I need to decrement the figure by one, but not going below 0. Does anyone know how I could do this in SQL? Or do I need an IF stmt in PHP? Thanks... Quote Link to comment Share on other sites More sharing options...
Tyche Posted April 20, 2007 Share Posted April 20, 2007 Why not try UPDATE users SET images=images-1 WHERE userid=x AND images > 0; Quote Link to comment Share on other sites More sharing options...
marmite Posted April 20, 2007 Author Share Posted April 20, 2007 Oh yeah! Thanks! 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.