Napisałem metodę do sprawdzania, czy wpisany do formularza mail istnieje w bazie czy nie. Wszystko jest ok, gdy adres istnieje, wtedy wyświetla "This email address exists." . Ale kiedy wpisanego maila nie ma w bazie, powinno wyświetlić "It does not exist.", ale zamiast tekstu wyświetla mi się puste okno. Co jest źle, że nie wyświetla tekstu.?
public function email_exists($email)
{
$stmt= $this->pdo->prepare ('SELECT email FROM users WHERE email=:email LIMIT 1');
$stmt-> bindValue (':email', $_POST['email'], PDO::PARAM_STR);
$stmt-> execute();
while ($row= $stmt-> fetch())
{
if ($row['email'] == $email)
{
$this-> message= 'This email address exists.';
}
else
{
$this-> message= 'It does not exist';
}
}
$stmt-> closeCursor();
}