prepare("SELECT SUM(total_price) as total_revenue FROM orders WHERE status = ?"); $stmt_revenue->execute(['completed']); $total_revenue = $stmt_revenue->fetchColumn(); // Total Orders $total_orders = $pdo->query("SELECT COUNT(*) FROM orders")->fetchColumn(); // Total Customers $total_customers = $pdo->query("SELECT COUNT(*) FROM users WHERE role = 'customer'")->fetchColumn(); // Most Popular Restaurants $stmt_popular = $pdo->query(" SELECT r.name, COUNT(o.id) as order_count FROM restaurants r JOIN orders o ON r.id = o.restaurant_id GROUP BY r.id ORDER BY order_count DESC LIMIT 5 "); $popular_restaurants = $stmt_popular->fetchAll(); // Fetch all restaurants for the management table $stmt_restaurants = $pdo->query("SELECT id, name, cuisine FROM restaurants ORDER BY name"); $restaurants = $stmt_restaurants->fetchAll(); ?>

Admin Dashboard

Total Revenue
$
Total Orders
Total Customers
Most Popular Restaurants
  • orders

Restaurant Management

Add New Restaurant

Name Cuisine Actions
Manage Menu Edit Delete