<?php
include("conex.php");

if (isset($_POST['idsorteo'])) {
    $idsorteo = $_POST['idsorteo'];

    // Actualizar la condición a 0 (deshabilitar)
    $sql = "UPDATE tbr_sorteo SET condicion = 0 WHERE idsorteo = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param('i', $idsorteo);
    $stmt->execute();

    if ($stmt->affected_rows > 0) {
        echo json_encode(['success' => true]);
    } else {
        echo json_encode(['success' => false]);
    }
} else {
    echo json_encode(['success' => false]);
}
?>
