kevincro Posted October 23, 2007 Share Posted October 23, 2007 I'm trying to update a database row. I don't know if there is something wrong with my PHP or the mysql query. mysql_query("UPDATE `playerranks` SET player_points=player_points + $Amount WHERE player_name=$Player_Name"); all my variables are set to the desired value. Quote Link to comment https://forums.phpfreaks.com/topic/74522-solved-need-help-with-an-update-statement/ Share on other sites More sharing options...
marcus Posted October 23, 2007 Share Posted October 23, 2007 mysql_query("UPDATE `playerranks` SET `player_points`=`player_points` + $Amount WHERE `player_name`='{$Player_Name}'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/74522-solved-need-help-with-an-update-statement/#findComment-376634 Share on other sites More sharing options...
BlueSkyIS Posted October 23, 2007 Share Posted October 23, 2007 yes, always or die(mysql_error()); you may need to paren your addition: SET player_points = (player_points + $Amount) Quote Link to comment https://forums.phpfreaks.com/topic/74522-solved-need-help-with-an-update-statement/#findComment-376635 Share on other sites More sharing options...
kevincro Posted October 23, 2007 Author Share Posted October 23, 2007 Thank you so much, that worked perfectly Quote Link to comment https://forums.phpfreaks.com/topic/74522-solved-need-help-with-an-update-statement/#findComment-376637 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.