Jump to content

I get the follow error


h1234

Recommended Posts

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;

 

}

 


Link to comment
https://forums.phpfreaks.com/topic/282556-i-get-the-follow-error/
Share on other sites

you need to stop creating new threads for the same issue/code.

 

taking out the mysqli_error() statement only means that the error moved down in the code.

 

you need to go back to your first thread and solve what is wrong with the msyqli_error() statement so that it will then tell you why your query is failing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.