When integrating HTML Purifier into a PHP script, an error occurs in line 22: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given. The error is triggered when attempting to check the number of rows returned by a MySQL query.
The error is caused by an incorrect SQL query in line 22, which is:
$dbc = mysqli_query($mysqli,"SELECT users.*, profile.* FROM users INNER JOIN contact_info ON contact_info.user_id = users.user_id WHERE users.user_id=3");
The error is: "You do not join with profile anywhere." This means that the query is trying to join the users and profile tables on the user_id column, but the profile table is not included in the FROM clause.
To fix the issue, the profile table needs to be included in the FROM clause, like so:
$dbc = mysqli_query($mysqli,"SELECT users.*, profile.* FROM users INNER JOIN profile ON contact_info.user_id = users.user_id WHERE users.user_id=3");
With this change, the query will correctly join the users and profile tables and return the desired results.
The above is the detailed content of Why Does `mysqli_num_rows()` Return a Boolean Instead of a `mysqli_result` Object?. For more information, please follow other related articles on the PHP Chinese website!