I have two tables, students and companies which both have a column named email. I need to check if an entered emailaddress exists in the tables.
I tried this:
$query = "select
NOT EXISTS (select email from students where email = '$email') AND
NOT EXISTS (select email from companies where email = '$email')";
$result = mysql_query($query) or die(mysql_error());
But this always returns that the email address already exists.
How should i preform this check correctly?