$sql="SELECT * FROM accounts,adminaccount WHERE accounts.emailaddress='$username' and accounts.password='$password' or adminaccount.emailaddress='$username' and adminaccount.password='$password'";
$result = mysql_query($sql);
$count=mysql_num_rows($result);
$row = mysql_fetch_assoc($result);
$usertype = $row['usertype'];
if($count==1)
{
$_SESSION['usertype']= $row['usertype'];
$_SESSION['id'] = $row['id'];
if($usertype == "admin")
{
header("location:indexadmin.php");
}
else
{
header("location:indexmember.php");
}
}
else
{
header("location:index.php?page=loginfail.php");
}
?>
I wanted it to go into indexadmin.php location if the account's usertype is admin else it will head to indexmember.php. But even if i log a normal user account it will still go to indexadmin.php. Help please.
Thanks in advance.