Staff page Ranks

Stephan

New Member
Jun 23, 2012
12
0
Hello. Can someone help me with my staff page? When I enter this PHP code on my website it shows the rank ID 5 and higher. But I only want the rank ID 5 and not higher and not lower. How to do that? Here's the PHP code:

PHP:
<?php
    $GetRanks = mysql_query("SELECT id, name FROM ranks WHERE id > '5' ORDER BY id DESC");
    while($Ranks = mysql_fetch_assoc($GetRanks))
    {
        $GetUsers = mysql_query("SELECT username,motto,last_online,online,look FROM users WHERE rank = {$Ranks['id']}");
        while($Users = mysql_fetch_assoc($GetUsers))
        {
                    if($Users['online'] == 1){ $OnlineStatus = "<font color=\"green\">Online</font>"; } else { $OnlineStatus = "<font color=\"red\">Offline</font>"; }
            echo "<img style=\"position:absolute;\" src=\"http://www.habbo.nl/habbo-imaging/avatarimage?figure={$Users['look']}&head_direction=3&direction=3&gesture=sml&action=std&size=b\">"
                ."<p style=\"margin-left:70px;margin-top:40px;\"><strong>{$Users['username']} ({$OnlineStatus})</strong><br>Missie: <i>{$Users['motto']}</i><br><small>Laatste bezoek: ". date("D, d F Y H:i (P)", $Users['last_online']) ."</small></p><br><br>";
        }
        echo "</p><br>";
    }
?>

Thanks for helping.
 

Legion

Gaming Lord
Staff member
Nov 23, 2011
1,801
669
The code you used was
Code:
<?php
    $GetRanks = mysql_query("SELECT id, name FROM ranks WHERE id > '5' ORDER BY id DESC");
    while($Ranks = mysql_fetch_assoc($GetRanks))
    {
        $GetUsers = mysql_query("SELECT username,motto,last_online,online,look FROM users WHERE rank = {$Ranks['id']}");
        while($Users = mysql_fetch_assoc($GetUsers))
        {
                    if($Users['online'] == 1){ $OnlineStatus = "<font color=\"green\">Online</font>"; } else { $OnlineStatus = "<font color=\"red\">Offline</font>"; }
            echo "<img style=\"position:absolute;\" src=\"http://www.habbo.nl/habbo-imaging/avatarimage?figure={$Users['look']}&head_direction=3&direction=3&gesture=sml&action=std&size=b\">"
                ."<p style=\"margin-left:70px;margin-top:40px;\"><strong>{$Users['username']} ({$OnlineStatus})</strong><br>Missie: <i>{$Users['motto']}</i><br><small>Laatste bezoek: ". date("D, d F Y H:i (P)", $Users['last_online']) ."</small></p><br><br>";
        }
        echo "</p><br>";
    }
?>
The part you missed was
Code:
 WHERE id = '5' ORDER BY id DESC
Just change the code to
Code:
<?php
    $GetRanks = mysql_query("SELECT id, name FROM ranks WHERE id = '5' ORDER BY id DESC");
    while($Ranks = mysql_fetch_assoc($GetRanks))
    {
        $GetUsers = mysql_query("SELECT username,motto,last_online,online,look FROM users WHERE rank = {$Ranks['id']}");
        while($Users = mysql_fetch_assoc($GetUsers))
        {
                    if($Users['online'] == 1){ $OnlineStatus = "<font color=\"green\">Online</font>"; } else { $OnlineStatus = "<font color=\"red\">Offline</font>"; }
            echo "<img style=\"position:absolute;\" src=\"http://www.habbo.nl/habbo-imaging/avatarimage?figure={$Users['look']}&head_direction=3&direction=3&gesture=sml&action=std&size=b\">"
                ."<p style=\"margin-left:70px;margin-top:40px;\"><strong>{$Users['username']} ({$OnlineStatus})</strong><br>Missie: <i>{$Users['motto']}</i><br><small>Laatste bezoek: ". date("D, d F Y H:i (P)", $Users['last_online']) ."</small></p><br><br>";
        }
        echo "</p><br>";
    }
?>
 

Users who are viewing this thread

Top