Hi, i have a problem with my code...
I was dealing with registration and validation forms... and I encountered this problem.
When i enter an e-mail my code doesn't recognize it as already in use... and adds another user with the same email. It doesn' say any error, just adds the new user with the same email in the table.
here my code:
<?php
include ("phpconnect.php");
mysqli_select_db($connect, $database);
echo "connected to $database<br>";
$name = $_POST['user'];
$surname = $_POST['surname'];
$password = $_POST['password'];
$email = $_POST['email'];
$reemail = $_POST['email'];
$check = mysqli_query($connect, "SELECT * FROM users WHERE email = '.$email.'");
if(mysqli_num_rows($check) > 0){
echo "The email is already in use!";
}else{
mysqli_query($connect, "INSERT INTO users (name, surname, password, email) VALUES ('$name', '$surname', '$password', '$email')");
echo "added $email";
mysqli_close($connect);
}
?>
I tried everything by looking on google ...