prepare("SELECT c.id, mi.name, mi.price, c.quantity, r.name as restaurant_name, r.id as restaurant_id FROM cart c JOIN menu_items mi ON c.menu_item_id = mi.id JOIN restaurants r ON mi.restaurant_id = r.id WHERE c.user_id = :user_id"); $stmt->bindParam(':user_id', $userId); $stmt->execute(); $cartItems = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($cartItems)) { header("Location: cart.php"); exit(); } $totalPrice = 0; foreach ($cartItems as $item) { $totalPrice += $item['price'] * $item['quantity']; } $delivery_fee = 5.00; $totalPriceWithDelivery = $totalPrice + $delivery_fee; include 'header.php'; ?>