So I'm trying to display all the users in a table but some of the information only admins can see, this is my code so far, I got no errors when I checked it on phpcodechecker.com but when I go to the page I get an HTTP error 500. This is my code so far.
Code:
<?php
$res=mysql_query("SELECT * FROM users");
$userRow=mysql_fetch_array($res);
$you=mysql_query("SELECT * FROM users WHERE userId=".$_SESSION['user']);
$viewer=mysql_fetch_array($you);
echo '<table>
<tr>
<th>Username</th>
';
if ($viewer['userPerm'] == 1) {
echo '<th>ID</th>
<th>Email</th>';
}
echo '</tr>';
while($userRow){
echo '<tr>
<td><font size="2" face="Lucida Sans Unicode" color=#000000>'.$userRow['userName'].'</td>
';
if ($viewer['userPerm'] == 1) {
echo '<td><font size="2" face="Lucida Sans Unicode" color=#000000>'.$userRow['userID'].'</td>
<td><font size="2" face="Lucida Sans Unicode" color=#000000>'.$userRow['userEmail'].'</td>';
}
echo '</tr>';
}
echo '</table>';
?>