Php I get this error Warning: mysqli_error() expects parameter 1 to be
mysqli, boolean given in
Hello i get the error below i need to create a login system for a project
for school. below is the code.This basically checks the username and
password if its correct.if the condition is true i want to return the user
id or otherwise it should return false.
function login($username , $password){
GLOBAL $dbc; //database connect
$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'");
MYSQLI_ERROR($query);
$check= mysqli_fetch_array( $query , MYSQLI_BOTH); // even if i add this
set of code the query
still gives the above error.
}
No comments:
Post a Comment