Making user ranks, I'm new so. But why isn't this working?

[php]$sql1 = mysql_query(“SELECT * FROM users WHERE rank = ‘$rank’”);
if(mysql_num_rows($sql1) > 0){
echo "









$uname


0 messages

Admin Panel


";
}else {
echo "








$uname


0 messages

Admin panel


";
}[/php]

Unless $uname is defined elseware in the script, its not going to automatically know what to change for that variable.

It is described in the script. It’s just I want to make ranks, so if a rank 2 users for example logs on they get an option for admin panel but if the user is > 2 they don’t get access

ah, ok. easy enough. [php]
$sql1 = mysql_query(“SELECT * FROM users WHERE rank = ‘$rank’”);
$r = mysql_fetch_assoc($sql1);
if(mysql_num_rows($sql1) > 0) { // this checks to see if the query returned any results
if($r[‘rank’] == 2) { // this checks the user’s rank
echo "










$uname
0 messages
Admin Panel

";
}else {
echo "







$uname
0 messages

";
}
}[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service