<?php
require_once __DIR__ . '/../include/db.php';

if (!isset($_GET['id'])) {
    header("Location: orders_list.php");
    exit;
}

$order_id = intval($_GET['id']);

// Prepared statement (secure)
$stmt = $conn->prepare("DELETE FROM orders WHERE id = ?");
$stmt->bind_param("i", $order_id);

if ($stmt->execute()) {
    header("Location: orders_list.php?success=deleted");
    exit;
} else {
    echo "❌ Order delete failed!";
}
?>