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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.