I looking for a way to login by using details from two mysql tables. I made a code and everything works fine but when I login it show the message that the email or password is incorrect and then login successfully.
Here is my code:
if(isset($_POST['submit']))
{
$email = $_POST['Email'];
$password = $_POST['password'];
$checkUser1 = "SELECT * FROM table1 where theEmail = '$email' AND thePass = '$password' ";
$checkUser2 = "SELECT * FROM table2 where theEmail = '$email' AND thePass = '$password' ";
$run = mysql_query($checkUser1,$checkUser2);
if (mysql_num_rows($run) > 0){
$_SESSION['Email']= $email;
echo "<script>window.open('HomePage.php','_self')</script>";
} else {
echo "<script>alert('incorrect email or password !')</script>";
}
}