prepare("SELECT name, address, phone FROM restaurants WHERE id = :id"); $stmt->execute(['id' => $restaurant_id]); $restaurant = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { error_log("DB error fetching restaurant: " . $e->getMessage()); } if (!$restaurant) { die("Restaurant not found."); } // Fetch menu items $menu_items = []; try { $stmt = $pdo->prepare("SELECT name, description, price, category FROM menu_items WHERE restaurant_id = :restaurant_id ORDER BY category, name"); $stmt->execute(['restaurant_id' => $restaurant_id]); $menu_items = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { error_log("DB error fetching menu items: " . $e->getMessage()); } // Group menu items by category $menu_by_category = []; foreach ($menu_items as $item) { $category = $item['category'] ?: 'Uncategorized'; $menu_by_category[$category][] = $item; } ?> Menu for <?= htmlspecialchars($restaurant['name']) ?>

This restaurant hasn't added any menu items yet.

$items): ?>