Posted on Sunday 1st June 2008 at 09:30 AM | |
Nathan Active Member |
<?php include("online.php"); $get_online_users = mysql_query("SELECT * FROM `users` WHERE `online` >= '$offline' ORDER BY `level` ASC"); $total_users = mysql_num_rows($get_online_users); if($total_users == 0){ echo "No Users Online!"; }else{ $i = 1; //the variable 'i' is 1 while($online = mysql_fetch_array($get_online_users)){ if(($i > 0) && ($i != $total_users)){ }else{ } echo "<a href='members.php?user=$online[username]'>$online[username]</a>$comma"; } } ?> how would i get name colouring by there levels on that please help...... |
Posted on Thursday 5th June 2008 at 11:17 AM | |
ilyas-shezad Junior Member |
There are different ways to do it. You can.... Use statements... Code if ($online['userlevel'] == "0"){ $color="blue"; }elseif ($online['userlevel'] == "1"){ $color="green"; } //then echo all of it... echo "<a href='members.php?user=$online[username]'><font color='$color'>$online[username]</font></a>$comma"; /*as you can see the font color tags are inside the a href tags. This is because the a href tags sometimes automatically set colours for texts so you have to put tjhe color tags inside the a tags if u no wat i mean.*/ Or you can use other stuff like arrays or db stuff. Note the above way i provided may not be the best way to do it. |
Posted on Friday 6th June 2008 at 06:59 AM | |
SkillMaster Senior Member |
Code if ($online['userlevel'] == "6") { $color = "red"; } elseif ($online['userlevel'] == "4") { $color = "blue"; } elseif ($online['userlevel'] == "2") { $color = "green"; } echo "<a href=\"members.php?user=$online[username]\"><font color=\"$color\">$online[username]</font></a>$comma"; Just fixed it up a bit from ilyas. he was on the right track though. |