$db = Database::getConnection(); $query = 'SELECT * FROM users WHERE activated=1'; $output = $db->query($query); $results = $output->fetchAll(PDO::FETCH_ASSOC); if (count($results) > 0) { echo "<table cellspacing=\"0\">"; echo "<tr><th>UserID</th><th>Username</th><th>Reported</th></tr>"; foreach($results as $result){ echo "<tr>\n"; $username = $result['username']; echo "<td>$result[userID]</td>"; echo "<td>$result[username]</td>"; $reportsQuery = "SELECT reported COUNT(*) FROM reports WHERE reported = '$username'"; $reportsOutput = $db->query($reportsQuery); while ($row = $reportsOutput->fetch(PDO::FETCH_ASSOC)){ echo '<td>Report count</td>'; } echo "</tr>\n"; } } else { echo 'There are no active users!'; } echo "</table>";?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)