Hello, I've been using a book to learn php, and when I try to make it work for my own use, there seems to be an error when I try to login. First it says that the log in is invalid, and it comes up with this warning message:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\Program Files\wamp\www\loginsite\login.php on line 25
if (!empty($user_username) && !empty($user_password)) {
// Look up the username and password in the database
$query = "SELECT user_id, username FROM mismatch_user WHERE username = '$user_username' AND password = SHA('$user_password')";
$data = mysqli_query($dbc, $query);
//below is line 25 of code
if (mysqli_num_rows($data) == 1) {
// The log-in is OK so set the user ID and username session vars (and cookies), and redirect to the home page
$row = mysqli_fetch_array($data);
$_SESSION['user_id'] = $row['user_id'];
I can post more code if I need to
Thanks