<?php
require_once('includes/load.php');
global $db;

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id'])) {
    $id = $_POST['id'];

    // Prepare the SQL statement
    $stmt = $db->prepare("DELETE FROM paket_bundling WHERE id = ? LIMIT 1");

    if ($stmt) {
        $stmt->bind_param("i", $id); // 's' means string
        $success = $stmt->execute();
        $stmt->close();
        echo json_encode(['success' => $success]);
        exit;
    } else {
        echo json_encode(['success' => false, 'error' => 'Prepare failed']);
        exit;
    }
}

echo json_encode(['success' => false]);
exit;
