I need a little help :(, I am just practicing these queries and I have a problem when verifying the existence of an ID (rut) before registering it in my database ... but the filter does not work: [
This is my code:
$votador = $_POST['rut'];
$sql = "SELECT * FROM votante WHERE rut = '$votador'";
$result = $conn->query($sql);
if ($result->num_rows >= 1) {
echo "El rut ya existe.";
}else{
$sql = "INSERT INTO votante VALUES (NULL,'".$_POST['rut']."')";
$result = mysql_query($sql);
if (! $result){
echo "La consulta SQL contiene errores.".mysql_error();
exit();
}else{
header('Location: votaciones.php');
}
}