prepare("SELECT * FROM orders WHERE user_id = ? ORDER BY created_at DESC"); $stmt->execute([$user_id]); $orders = $stmt->fetchAll(); ?>
| Order ID | Date | Total | Status | Action |
|---|---|---|---|---|
| $ | View Details / Track prepare("SELECT id FROM ratings WHERE order_id = ?"); $stmt_rating->execute([$order['id']]); $existing_rating = $stmt_rating->fetch(); // If order is delivered and no review exists, show the 'Leave a Review' link if ($order['status'] === 'Delivered' && !$existing_rating): ?> Leave a Review |