Im having this error mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in line 121 when I try to login to the system. here is my code section for particular problem. Does anyone know why this is happen to the code ?
if(isset($_POST["loginbtn"]))
{
$uid = $_POST["userid"];
$pword = $_POST["userpass"];
$result = mysql_query("SELECT * FROM admin WHERE Ad_ID = '$uid' AND Ad_Pass = '$pword'
");
if($row = mysql_fetch_assoc($result))
{
$_SESSION ["loggedin"] = "true" ;
$_SESSION ["adid"] = $row ["Ad_ID"];
$_SESSION ["adname"] = $row ["Ad_Name"];
$_SESSION ["adaright"] = $row ["Ad_ARight"];
if($row ["Ad_ARight"]=='write')
header('Location: HomeScreen.php');
else if($row ["Ad_ARight"]=='read')
header('Location: HomeScreenr.php');
}
else
{
echo '<div class="alert-message error"><p><b> Invalid username or
password </b></p></div>';
}
}
?>
<div align="center">