Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given
its a login form here is my code thats producing the error .i need to test if user_is true.
function login($username , $password){
GLOBAL $dbc; //database
$user_id= user_id_from_username($username);
$username = sanatize($username);
$password = md5($password);
$query= mysqli_query($dbc,"SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password ` = '$password'");
$check= mysqli_fetch_array( $query , MYSQLI_BOTH); // even if i add this set of code the query still gives the above error.
return ($check[0]==1)? $user_id : false;
}