Jump to content

[SOLVED] Logic Problem? MYSQL not updating


Nexy

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.