When upgrading my web site from 5.x to 6.x I got the following PHP error :
"PHP Fatal error: Call to undefined function db_num_rows() in html/sites/all/modules/autologout/autologout.module on line 260".
I probably missed something but I don't see what. Could anybody tell me what ?

Thanks for your help.

Comments

redpuma’s picture

Version: 6.x-2.1 » 6.x-1.5
Priority: Critical » Normal

We have the same error too. And we had the same error on the 2.1 version. I found this post
http://drupal.org/node/236969

Is it because db_num_rows() doesn't exist in D6?

redpuma’s picture

Version: 6.x-1.5 » 6.x-2.1
Priority: Normal » Critical
StatusFileSize
new701 bytes

As I said we tried the 2.1 version and had the same error but on line 264. Site unusable, had to remove module from code base to regain access.
Following the info in the above link we came up with a patch, it works, sorry if its not up to standard but I'm up against a tight deadline.

prunelle’s picture

Version: 6.x-1.5 » 6.x-2.1
Priority: Normal » Critical

Thanks Redpuma.
I also saw that it was a known problem for the port from D5 to D6. Does anybody (I don't have the skill and the time yet ...) plan to integrate this patch into the module code ?

Leeteq’s picture

StatusFileSize
new5.85 KB

For those who cannot patch, here is a working patched 6.x-2.1 version from the patch in #2 above. Havent tested it thoroughly yet, but saving various configurations and enabling it works without errors.

jvandervort’s picture

Status: Active » Fixed

Fixed in 6.x-2-2

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xjessie007’s picture

Just a FYI for those who run into this issue.

db_num_rows() is defined in Drupal 4 and 5 in the database.mysql.inc as follows:

function db_num_rows($result) {
  if ($result) {
    return mysql_num_rows($result);
  }
}

http://api.drupal.org/api/function/db_num_rows/4.6
It is not defined in Drupal 6. If you do not mind hacking the code and if you are using MySQL, you can just replace calls to db_num_rows() with PHP core function mysql_num_rows().

  • Commit f3386c9 on 6.x-2.x, 7.x-2.x, 7.x-5.x, 7.x-4.0, 8.x-1.x by jvandervort:
    #362733 by redpuma, fixes call to undefined db_num_rows().