login php with different user by classified the code using nested if method, however, it will only run the first if but not the second
$sql= mysql_query("SELECT * FROM user WHERE id= '$id' AND password= '$password'");
$sql1 = "SELECT position FROM user WHERE id ='$id' AND password = ' $password'";
if(mysql_num_rows($sql) > 0)
{
if($sql1 = "student" )
where the nested if begin
{
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Login Succesfully!.')
window.location.href='google.com.my'
</SCRIPT>");
}
else if($sql1 = "lecturer" )**it will not run until this if **
{
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Login Succesfully123!.')
window.location.href='www.yahoo.com'
</SCRIPT>");
}
exit();
}
else{
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Wrong username password combination.Please re-enter.')
window.location.href='login.html'
</SCRIPT>");
exit();
}
}
?>