$sqlxx = mysql_query("select * from user where username = '$_SESSION[username]'");
$resultSetxx = mysql_fetch_array($sqlxx);
$userid = $resultSetxx['id'];
$usercrew = $resultSetxx['crew'];
$sqlxx = mysql_query("SELECT * FROM crew WHERE id='$usercrew'");
$crew_infoxx = mysql_fetch_array($sqlxx);
$usercrewleader = $crew_infoxx['leader'];
if ($userid == $usercrewleader) {
$user_id = $_GET['id'];
$sql = mysql_query("select * from user where id = '$user_id'");
$r = mysql_fetch_array($sql);
$rank = $r['rank'];
if ($rank = 1) {
echo "This user is already Rank 1.";
} else {
$sqlfrom = mysql_query("select * from user where id = '$user_id'");
$rfrom = mysql_fetch_array($sqlfrom);
$rupdate = $rank - 1;
$q1 = mysql_query("UPDATE user SET rank = '$rupdate' WHERE id='$user_id'");
echo "Users Rank was Upgraded.";
}
} else {
echo "You're not allowed to do this, only your leader can do this.";
}
}
I can't seem to find the error, I am currently set to leader, and even when the user I want to upgrade is set to 5, it still says "This user is already rank 1" I figure its an error in my way that I did the }else{, it might be a little messy.