Guest 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 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 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...
Guest Posted December 6, 2010 Share Posted December 6, 2010 UPDATE account_info SET experience = experience + 7 WHERE username = $name This worked perfectly, thanks a lot. 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
Archived
This topic is now archived and is closed to further replies.