I created a PHP function on my website to recognize if the user is a normal, banned, pro, top player or an admin. But whenever the function goes around a username it always moves the username to the front of the loop from where it originally was.
Notice where the username is...
Now see where it is now?
Well here is the function script..
<?php
function username($username){
$staff = "SELECT * FROM users WHERE usergroup = 'Staff' AND username = '".$username."'";
if( mysql_num_rows( mysql_query( $staff ) ) == 1 ){
echo "<span class='staff'>".$username."</span>";
}
$pro = "SELECT * FROM users WHERE usergroup = 'Pro' AND username = '".$username."'";
if( mysql_num_rows( mysql_query( $pro ) ) == 1 ){
echo "<span>".$username."</span>";
}
$topplayer = "SELECT * FROM users ORDER BY points DESC LIMIT 1";
$result3 = mysql_query($topplayer);
while($row = mysql_fetch_array($result3)){
if($username==$row['username']){
echo "<span>".$username."</span>";
} else {
$else = "SELECT * FROM users WHERE banned != 'yes' AND username = '".$username."' AND usergroup != 'Staff' AND usergroup != 'Pro'";
if( mysql_num_rows( mysql_query( $else ) ) == 1 ){
echo "<span>".$username."</span>";
} } }
$banned = "SELECT * FROM users WHERE banned = 'yes' AND username = '".$username."'";
if( mysql_num_rows( mysql_query( $banned ) ) == 1 ){
echo "<span>".$username."</span>";
}
}
?>
Any help is appreciated!