Here is my code. But, it does not work properly, once i login using username and password is shows error message like this:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\lumbiniinternational_hotel\administrator\login.php on line 26
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\lumbiniinternational_hotel\administrator\login.php on line 27
My full Code is:
if(isset($_POST['submit'])){
$query="SELECT * FROM users WHERE username='".$_POST['username']."' AND password='".$_POST['password']."' AND role='administrator'";
$result=mysql_query($query);
$row=mysql_fetch_array($result,MYSQL_ASSOC);
if(mysql_num_rows($result)>0){
header("Location:index.php");
$_SESSION['username']=$row['username'];
}else
$message=get_word($lang,"Wrong username or password.");
}
?>