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. 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()); 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) 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 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
Archived
This topic is now archived and is closed to further replies.