Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error Log going nuts on 2.3.4 bootstrap


beemertec

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?

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...