I'm making a script to add new users.
All is working fine, but now I'm trying to filter out duplicate emails. So if the email already exists it should give an error message.
But for some reason $count
always is > 0...
This is my code:
$query = $db->prepare("SELECT COUNT(*) FROM `users` WHERE `email` = ':email'");
$query->execute(array(
':email' => $email
));
$count = $query->rowCount();
echo $count;
What am I doing wrong?