scarhand Posted July 4, 2007 Share Posted July 4, 2007 if ($_POST['adminusername'] != $adminusername) { $newadminusername = mysql_real_escape_string($_POST['adminusername']); mysql_query("UPDATE admin_user SET username=$newadminusername WHERE username=$adminusername"); $status_msg .= "Your username has been changed to" . $newadminusername . ".<br />"; $_SESSION['adminusername'] = $newadminusername; } Whats wrong with this code? I'm stumped! Quote Link to comment Share on other sites More sharing options...
no_one Posted July 4, 2007 Share Posted July 4, 2007 " ... SET username='$newadminusername' WHERE username='$adminusername'" (I put single quotes around the $*adminusername vars) Might want to try printing mysql_error() Quote Link to comment Share on other sites More sharing options...
scarhand Posted July 4, 2007 Author Share Posted July 4, 2007 " ... SET username='$newadminusername' WHERE username='$adminusername'" (I put single quotes around the $*adminusername vars) Might want to try printing mysql_error() Thanks for the help, the quotes helped. I'm using this and its working fine now: if ($_POST['adminusername'] != $adminusername) { $newadminusername = mysql_real_escape_string($_POST['adminusername']); mysql_query("UPDATE admin_user SET username='$newadminusername' WHERE username='$adminusername' ") or die(mysql_error()); $update_msg .= "The admin username has been changed to " . $newadminusername . ".<br />"; $_SESSION['adminusername'] = $newadminusername; $adminusername = $newadminusername; } Quote Link to comment 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.