darkfreaks Posted June 15, 2008 Share Posted June 15, 2008 <?php mysql_query("UPDATE users SET username = '$euser', email = '$eemail', avatar = '$eavatar', currency = '$ecurrency' WHERE username = '".$_SESSION['usere']."'");?> Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-565736 Share on other sites More sharing options...
Nexy Posted June 15, 2008 Author Share Posted June 15, 2008 What did you change? Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-565738 Share on other sites More sharing options...
darkfreaks Posted June 15, 2008 Share Posted June 15, 2008 nothing just removed the htmpspecialchar syntax what was that AND? ??? Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-565755 Share on other sites More sharing options...
Nexy Posted June 15, 2008 Author Share Posted June 15, 2008 I don't understand you. The query works perfectly fine as I have it. Problem is some members don't get updated for some reason. Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-565761 Share on other sites More sharing options...
sasa Posted June 15, 2008 Share Posted June 15, 2008 in your 1st post you have mysql_query("UPDATE users SET username = '$euser' WHERE username = '".$user['username']."'"); mysql_query("UPDATE users SET email = '$eemail' WHERE username = '".$user['username']."'"); if($erank == "member") { mysql_query("UPDATE users SET rank = '2' WHERE username = '".$user['username']."'"); } else if($erank == "moderator") { mysql_query("UPDATE users SET rank = '3' WHERE username = '".$user['username']."'"); } else if($erank == "gmod") { mysql_query("UPDATE users SET rank = '4' WHERE username = '".$user['username']."'"); } else if($erank == "admin") { mysql_query("UPDATE users SET rank = '5' WHERE username = '".$user['username']."'"); } mysql_query("UPDATE users SET avatar = '$eavatar' WHERE username = '".$user['username']."'"); mysql_query("UPDATE users SET currency = '$ecurrency' WHERE username = '".$user['username']."'"); in 1st query you change value in field username and another query can't find right row Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-565767 Share on other sites More sharing options...
Nexy Posted June 15, 2008 Author Share Posted June 15, 2008 Not sure I follow you. The query you posted wasn't working, so I changed it to this: <?php if($_POST['esubmit'] && !empty($euser) && !empty($eemail) && !empty($erank) && !empty($eavatar) && !empty($ecurrency)) { if($erank == "member") { mysql_query("UPDATE users SET rank ='2' WHERE username = '".$_SESSION['usere']."'"); } else if($erank == "moderator"){ mysql_query("UPDATE users SET rank ='3' WHERE username ='".$_SESSION['usere']."'"); } else if($erank == "gmod") { mysql_query("UPDATE users SET rank ='4' WHERE username = '".$_SESSION['usere']."'"); } else if($erank == "admin") { mysql_query("UPDATE users SET rank ='5' WHERE username = '".$_SESSION['usere']."'"); } mysql_query("UPDATE users SET username = '$euser', email = '$eemail', avatar = '$eavatar', currency = '$ecurrency' WHERE username = '".$_SESSION['usere']."'"); echo "<div class='create' style='width: 400px; text-align: center; padding: .6em'> <img src='images/update.png' alt='' /> " . $_SESSION['usere'] . ' has been updated.</div>'; unset($_SESSION['usere']); } ?> This works just fine. The problem is some members update and others don't. I don't receive the "User has been updated" for some of the members. Link to comment https://forums.phpfreaks.com/topic/110174-solved-logic-problem-mysql-not-updating/page/2/#findComment-566023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.