+ 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)

9th Sep 2018, 8:06 PM
Med Arezki
Med Arezki - avatar
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”); }
9th Sep 2018, 9:48 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Thank you so much
17th Sep 2018, 12:56 PM
Med Arezki
Med Arezki - avatar