I am creating an admin area, where the admin can view the activities of the users.
There are two tables which display information. I am only finding success in displaying information of ONE USER.
This is my code:
[code=php]
<?php
$result = mysql_query(“SELECT * FROM users”);
while($row = mysql_fetch_array($result)) {
$id = $row[‘id’];
$username = $row[‘username’];
if ($id == 1) {
echo “<td valign=top>” . $row[‘givenname’] . ” ” . $row[‘surname’] . “<br>” . $row[‘homeaddy’] . “<br>” . $row[‘homecity’] . ” ” . $row[‘homeprov’] . ” ” . $row[‘homepost’] . “<br>” . $row[‘resphone’] . “</td>”;
echo “<td valign=top>” . $row[‘secspurch’] . “Common Shares </td>”;
echo “<td valign=top> $” . $row[‘agreamount’] . “.00</td>”;
echo “<td width=300px><table>”;
//Connect to Table
$query = “SELECT * FROM table2purchstats WHERE userid='{$username}'”;
$result = mysql_query($query, $link);
while($row = mysql_fetch_array($result)) {
//display checked boxes if equal to one
include (‘ABC_Completed_purchstats.php’);
echo “</table></td>”;
echo “<td valign=top>” . $row[‘date_completed’] . “</td>”;//not working yet
echo “</tr>”;
echo “<tr>”;
echo “</tr><tr>”;
}//closes while statement
} elseif($id == 2){
echo “<td valign=top>” . $row[‘givenname’] . ” ” . $row[‘surname’] . “<br>” . $row[‘homeaddy’] . “<br>” . $row[‘homecity’] . ” ” . $row[‘homeprov’] . ” ” . $row[‘homepost’] . “<br>” . $row[‘resphone’] . “</td>”;
echo “<td valign=top>” . $row[‘secspurch’] . “Common Shares </td>”;
echo “<td valign=top> $” . $row[‘agreamount’] . “.00</td>”;
echo “<td width=300px><table>”;
//Connect to Table
$query = “SELECT * FROM table2purchstats WHERE userid='{$username}'”;
$result = mysql_query($query, $link);
while($row = mysql_fetch_array($result)) {
//display checked boxes if equal to one
include (‘ABC_Completed_purchstats.php’);
echo “</table></td>”;
echo “<td valign=top>” . $row[‘date_completed’] . “</td>”;//not working yet
echo “</tr>”;
echo “<tr>”;
echo “</tr><tr>”;
}//closes while statement
}
echo “</tr><tr>”;
}//closes while statement
?>
The id’s check out, there are 2 of them, 1 and 2.
Thanks in advance!