Hi, I’m using the below object oriented code. It is sort of reversed. I have a simple database and one of the columns is “email”. Basically, I want the code to search the e-mails that already exist in the DB and return an error if what was entered in a form and validated via PHP already exists. It should then offer to return the user to the form page to try again. This is what I have so far and it doesn’t work! Help please! Thanks!
require_once('config/connect.php');
$sql = "SELECT * FROM referrals WHERE email='$friendmail'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
while($row = $result->fetch_array()){
echo "E-mail Already Referred!";
}
// Free result set
$result->free();
}
die();
}