Tengo que cambiar el valor/estado a un ENUM('0', '1') de un campo de una tabla. Lo voy a realizar con una consulta UPDATE con if incluido.
cambiar_estado.php:
<?php
//Dormimos el proceso unos segundos...
sleep(3);
//Consulta para actualizar el estado en la tabla "usuarios_datos".
$Sql = "UPDATE usuarios_datos if(estado = '0', SET estado = '1'), if(estado = '1', SET estado = '0') WHERE ID_OBLIGATORIO = '$_REQUEST["Id"];";
?>
<center>
<?php
echo "<a href=\"javascript:cargaXML('cambiar_estado.php?Id=".$_REQUEST["Id"]."','estado".$_REQUEST["Id"]."')\">";
echo $Sql;
echo "</a>";
?>
</center>
Error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if estado = 0 SET estado = 1 else if estado = 1 SET e' at line 1
if(estado = '0', SET estado = '1'), if(estado = '1', SET estado = '0')
no puede ir asi en mysql