connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } $mail = $_GET['mail']; $hash = $_GET['hash']; $statement = $db->prepare("select 1 from mails_datos where mail=? and hash=? and error is null"); $statement->bind_param("ss", $mail, $hash); $statement->execute(); if (!$statement->fetch()) { echo "Este email ($mail) no esta actualmente suscripto a nuestra base"; die(); } $statement->close(); $statement = $db->prepare("update mails_datos set error='unsuscribe' where mail=? and hash=?"); $statement->bind_param("ss", $mail, $hash); if(!$statement->execute()){ echo "Hubo un error desuscribiendolo de la base de datos"; die(); } echo "Desuscripto correctamente"; ?>