mastercjb Posted November 25, 2009 Share Posted November 25, 2009 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> Link to comment https://forums.phpfreaks.com/topic/182865-need-help-displaying-information-from-database/ Share on other sites More sharing options...
Gayner Posted November 25, 2009 Share Posted November 25, 2009 off the top of my head <> admin 0 try that Link to comment https://forums.phpfreaks.com/topic/182865-need-help-displaying-information-from-database/#findComment-965198 Share on other sites More sharing options...
mastercjb Posted November 25, 2009 Author Share Posted November 25, 2009 Where would I put that? Link to comment https://forums.phpfreaks.com/topic/182865-need-help-displaying-information-from-database/#findComment-965203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.