Jump to content

Need help displaying information from database


mastercjb

Recommended Posts

Ok, I have no idea how I can do this so I am hoping you can point me in the right direction. In my database I have a line in my users table called admin. In this 0 means they are a normal user, and 1 means they are an admin. Is there any way to edit my code posted below to show only normal users, I want it to show only ones with 0 in the admin line, then I need to be able to show only admins, so only people with a 1 in the admin line.

 

This code displays all of my users:

 

    <tr><td class="contenthead">.: List of students registered</td></tr>
    <tr><td class="contentcontent">
<table width='100%'>
<tr>

<td>Name</td>


<td align='center'>Online</td>
</tr>
<?
$view = ($_GET['view'] != "") ? $_GET['view'] : 'admin';


$result = mysql_query("SELECT * FROM `grpgusers` ORDER BY `".$view."` DESC LIMIT 500");
$rank = 0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$rank++;
$user_hall = new User($line['id']);
?>
<tr>

		<td><?= $user_hall->formattedname ?></td>
		<td><?= $user_hall->formattedonline ?></td>
</tr>
<?
}
?>

</td></tr>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.