This is my form:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="register_ajax.php" method="get">
<input type="text" name="email">
<input type="submit" value="test">
</form>
</body>
</html>
This is my php code:
<?php
$dbc = mysqli_connect("localhost","root","*******","continental_tourism") OR die(mysqli_connect_error());
$email = $_GET['email'];
$query = "SELECT email FROM customer_info WHERE email = '$email' ";
$r = mysqli_query($dbc, $query) OR die(mysqli_error($dbc));
if($r)
echo "Email address exists!";
else
echo "sss";
?>
If I enter a correct(Existing email on db) $r
is true. But if I enter non existing email, then also $r
is true. Why is that? Basically I want to detect the empty set. How can I do it?
Thanks!