I have two different table in database: (1) userreg (2)admin. i want to run a query which will first check in userreg table and then in admin table. if the user is found in userreg table then it will redirect to index.php page if the user found in admin table then the user will redirect to admin.php page. can anyone help me to do this?
$result = $conn->query("select * from userreg where email='$email' AND password = '$password'")||query("select * from admin where email='$email' AND password = '$password'");
$row = $result->fetch_array(MYSQLI_BOTH);
if($row)
{
/// session_start();
$_SESSION["fullname"] = $row['fullname'];
$_SESSION["email"] = $email;
$_SESSION["cellno"]= $row['cellno'];
$_SESSION["gender"]=$row['gender'];
$_SESSION["uid"]=$row['uid'];
$_SESSION['logged_in'] = true;
//header('Location: index.php');
$URL="./index.php";
echo '<META HTTP-EQUIV="refresh" content="0;URL=' . $URL . '">';
}