I have 2 pages in my admin panel. One shows the user a list of their clients, the other shows a list of their users (using the admin panel). The problem is, the are both in a table called users, so when I try to call them, everything shows up. I was wondering how to separate them by numbers, 0 being just a user/admin, and 1 being a client. Is there a code that can do this?
Here’s the code that calls the client information
$query = "SELECT client, type, projecttype, salesperson, modified, status, id FROM users";
$result = mysql_query($query) or die ("Error in query: $query.".mysql_error());
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<div align=center><table cellpadding=10 border=0><tr>
<td><b><font face=Arial></td>
<td><b><font face=Arial>CLIENT</td>
<td><b><font face=Arial>TYPE</td>
<td><b><font face=Arial>PROJECT NAME</td>
<td><b><font face=Arial>SALESPERSON</td>
<td><b><font face=Arial>STATUS</b></td>
<td></td> </tr>";
while(list($client, $type, $projecttype, $salesperson, $modified, $status, $id) = mysql_fetch_row($result)) {
echo "<tr>
<td><font face=Arial><a href='delete_client.php?id={$id}'><img border=0 alt='Delete' src='delete.jpg'></a></td>
<td><font face=Arial><a href='http://www.essentialaudioinc.com/admin/updateclientinfo.php?id={$id}'>$client</a></td>
<td><font face=Arial>$type</td>
<td><font face=Arial>$projecttype</td>
<td><font face=Arial>$salesperson</td>
<td><font face=Arial><b>$modified</b><br>$status</td>
</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "No info in database!";
}
and here’s the one that calls the users:
$result = mysql_query($query) or die ("Error in query: $query.".mysql_error());
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<div align=center><table cellpadding=10 border=0><tr>
<td><b><font face=Arial></td>
<td><b><font face=Arial>SALESPERSON</td>
<td><b><font face=Arial>E-MAIL</td>
<td><b><font face=Arial>PHONE</td>
<td><b><font face=Arial>ADDRESS</td>
<td></td> </tr>";
while(list($firstname, $lastname, $email, $phone, $address, $city, $state, $id) = mysql_fetch_row($result)) {
echo "<tr>
<td><font face=Arial><a href='delete_user.php?id={$id}'><img border=0 alt='Delete' src='delete.jpg'></a></td>
<td><font face=Arial><a href='http://www.essentialaudioinc.com/admin/updateuserinfo.php?id={$id}'>$firstname $lastname</a></td>
<td><font face=Arial>$email</td>
<td><font face=Arial>$phone</td>
<td><font face=Arial>$address - $city, $state</td>
</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "No info in database!";
}