+ 2
PHP adress check
Hi, I want to check on mySQL Database if a mail adress exist or not. How can we code that with PHP (and SQL if we need it). Like a connexion validation, we search if the email exists on the Database then we redirect the user into the profil or we send him an error if the email is not valid (don't exists on the DB)
2 Answers
+ 9
Count the amount of rows
$pre = $conn->prepare(âSELECT id FROM address WHERE address=:addressâ);
$pre->bindParam(â:addressâ, âvalueâ);
$pre->execute();
if($pre->rowCount()) {
header(âlocation: /profileâ);
} else {
die(âerrorâ);
}
+ 1
Thank you so much