I created a helper function and i use this a lot throughout my code get the following error.
but what i don't understand is I have zend server and my code runs fine on local host. why the grieve on a live server.
Warning: mysqli_ num_rows() expects parameter 1 to be mysqli_result, boolean on line 26
this is line 26
function row_count($result){
global $connection;
return mysqli_num_rows($result);
}
login code
function login_user($email, $password){
$active = 1;
$connection = dbconnect();
$stmt = $connection->prepare('SELECT user_pwd, user_id, username FROM users WHERE user_email = ? AND active= ?');
$stmt->bind_param('ss', $email, $active);
$stmt->execute();
$result = $stmt->fetch();
if (row_count($result) == 1) {
$row = fetch_array($result);
$db_password = $row['user_pwd'];
if (password_verify($password, $db_password)) {
$_SESSION['email'] = $email;
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['username'] = $row['username'];
return true;
} else {
return false;
}
return true;
} else {
return false;
}
}