Categories
query("SELECT categories.id AS id, categories.name AS name, categories.slug AS slug, ( SELECT COUNT(mods.id) FROM mods JOIN users ON users.id = mods.user WHERE mods.category = categories.id AND mods.is_removed = 0 AND users.is_suspended = 0 AND users.is_verified = 1 AND users.is_deleted = 0 LIMIT 1 ) AS count FROM categories;"); if (!$result) { echo "An unexpected error occurred while fetching categories.
"; } else { $categoriesPresent = false; while ($category = $result->fetch_assoc()) { $categoriesPresent = true; echo '' . htmlspecialchars($category['name']) . '
Mods: ' . htmlspecialchars(number_format($category['count'], 0)) . '
No categories.
'; } } ?>