prepare("DELETE FROM orders WHERE id = ?")->execute([$id]);
header("Location: orders.php?msg=deleted");
exit;
}
?>
Order History
View and manage all customer orders
Order record deleted successfully!
| Order ID |
Customer |
Product Details |
Amount |
Status |
Date |
Actions |
query($sql);
if($stmt->rowCount() > 0):
while($row = $stmt->fetch()):
// Status Logic
$status = strtolower($row['status'] ?? 'pending');
if($status == 'success' || $status == 'completed') {
$badgeClass = 'bg-success-soft';
} elseif($status == 'failed') {
$badgeClass = 'bg-danger-soft';
} else {
$badgeClass = 'bg-warning-soft';
}
// Initials for avatar
$name = !empty($row['user_name']) ? $row['user_name'] : 'Guest';
$initial = strtoupper(substr($name, 0, 1));
?>
| #= $row['id'] ?> |
= $initial ?>
= htmlspecialchars($name) ?>
= htmlspecialchars($row['user_email'] ?? 'No Email') ?>
|
= htmlspecialchars($row['product_name'] ?? 'Product Deleted') ?>
|
₹= number_format($row['total_amount'], 2) ?> |
= ucfirst($status) ?>
|
= date('d M Y', strtotime($row['created_at'])) ?>
|
|
No orders found.
|