Jump to content

Error Log going nuts on 2.3.4 bootstrap

Recommended Posts

PHP Warning:  mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/xxxxxx/public_html/vcom/includes/functions/database.php on line 104 

is showing up thousands of times in my error log.

Here is line 103 and 104 of  includes/functions/database.php

 function tep_db_num_rows($db_query) {
    return mysqli_num_rows($db_query);

 Any ideas?

Share this post

Link to post
Share on other sites

According to https://www.php.net/manual/en/mysqli.query.php the mysqli_query function returns false when it fails.  False is a Boolean value.  So it sounds like your database connection is failing.  You could probably fix that particular warning by changing line 104 to something like

    return is_bool($db_query) ? false : mysqli_num_rows($db_query);

But that won't fix the underlying problem.  We might be able to give you more help if you could show us the first error that it gives on a page load. 

For debugging, you might try

if (is_bool($db_query)) {
  error_log(print_r(debug_backtrace(), true));
  error_log(print_r($db_query, true));
  return false;

return mysqli_num_rows($db_query);

That will clog your error log even more but may produce useful debugging information. 

Always back up before making changes.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now