I am creating my own personal website to sell music and help local artists promote their music. However, I am experiencing a problem.
I created a registration page where a new user can be registered onto the system. I tried to search first whether the email exists or not from the database so that there are no duplicate emails on the tables. I created an if
statement for this so when the statement is true (meaning a duplicate email is found) it prints out the "email exists" but when it does not find any information from the db the screen remains blank where as the else part of the statement should kick in and print "no email found".
Can someone help me see where I went wrong? Here is my code:
if ($_POST['submit2']){
$fname = $_POST['Fname'];
$sname = $_POST['Sname'];
$email = $_POST['Emailaddress'];
$pass = $_POST['newpassword'];
$sql= "select * from cust_information where email = '$email'";
$results = mysqli_query($conn, $sql) or die(mysqli_error($conn));
$row = mysqli_fetch_array($results) or die(mysqli_error($conn));
if($row > 0){
echo "email exists";
}elseif ($row <0){
echo "email doesnt exist";
}else{
echo "nothing was done";
}
}