Hello,
I’m having some problems… I want the code to check if the submitted email address already exists in the database. If not, then it should add the email to the database.
The problem is that it doesn’t matter which email address I submit, it will still output the error message saying “email is already registered”. Even with an email I know doesn’t exists in the database, it will still output the same error.
Any help is appreciated.
[php]
<?php if(empty($_POST) === false) { $errors = array(); $email = $_POST['email']; $emailcheck = mysql_query("SELECT * FROM `rss`(`email`) WHERE `email` = '$email'"); if(empty($email) === true) { $errors[] = 'An email adress is required.'; } if(filter_var($email, FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Invalid email adress.'; } else if($emailcheck === false) { $errors[] = 'This email is already registered.'; } else { mysql_query("INSERT INTO `rss`(`email`) VALUE ('$email')"); } } ?>[/php]