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

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

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

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