Spring Posted December 5, 2010 Share Posted December 5, 2010 Hi, I have a field called experience in mysql and I want to add +7 to said field, is it possible using UPDATE or insert? If so, what's the syntax? Here's what I have that doesn't work, it sets experience to 7, but won't add another 7 when clicked again. if(isset($_POST['submit'])){ $query = "UPDATE account_info SET experience = +7 WHERE username = $name"; $result = mysql_query($query) or die(mysql_error()); } don't ask for the whole script, because you won't need it to answer that o.0 Quote Link to comment https://forums.phpfreaks.com/topic/220775-way-to-insert-7-into-a-field/ Share on other sites More sharing options...
Pikachu2000 Posted December 5, 2010 Share Posted December 5, 2010 UPDATE account_info SET experience = experience + 7 WHERE username = $name Quote Link to comment https://forums.phpfreaks.com/topic/220775-way-to-insert-7-into-a-field/#findComment-1143412 Share on other sites More sharing options...
Spring Posted December 6, 2010 Author Share Posted December 6, 2010 UPDATE account_info SET experience = experience + 7 WHERE username = $name This worked perfectly, thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/220775-way-to-insert-7-into-a-field/#findComment-1143421 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.