Linjon Posted February 8, 2010 Share Posted February 8, 2010 I need help with adding "points" to mysql. I have this code now: mysql_query("UPDATE `wc3_player_race` SET `id`='".$_GET['message']."', `race` ='1', `race_xp`='".$AddPoints."' "); But its only replaces points but i need it to add points. Hope you understand me Link to comment https://forums.phpfreaks.com/topic/191392-mysql-problem/ Share on other sites More sharing options...
jl5501 Posted February 8, 2010 Share Posted February 8, 2010 mysql_query("UPDATE `wc3_player_race` SET `id`='".$_GET['message']."', `race` ='1', `race_xp`= `race_xp` + ".$AddPoints); Link to comment https://forums.phpfreaks.com/topic/191392-mysql-problem/#findComment-1008991 Share on other sites More sharing options...
Linjon Posted February 11, 2010 Author Share Posted February 11, 2010 Thanks, that worked!! But i have new problem now. If i add points then it give points only for first user on database and change him id to 0. How can i fix it? <?php mysql_connect("localhost", "*******", "*****"); mysql_select_db("*********"); $result = mysql_query("SELECT `player_id` FROM `wc3_player` WHERE `player_name` ='".$_GET['message']."'"); if(mysql_num_rows($result) == 0) { echo 'Cant find that name'; } if(mysql_num_rows($result) > 0) { echo 'Points are added'; $addxp = $row['race_xp'] = 75000; mysql_query("UPDATE `wc3_race` SET `player_id`='".$_GET['message']."', `race_id` ='1', `race_xp`= `race_xp` + ".$addxp); } ?> Link to comment https://forums.phpfreaks.com/topic/191392-mysql-problem/#findComment-1010928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.