After upgrading from Drupal 5.2 to 6.14, I ran the update.php. With Privatemsg & Bookmarks module, the update output errors. But when I try to go to the Admin pages, I get the error - Fatal error: Call to undefined function db_num_rows() in /home/sourasht/public_html/test/includes/common.inc(1685) : eval()'d code on line 11.

I have checked for existence of db_num_rows() in the entire Drupal installation directory, but didn't find any. I have also tried removing all the contrib modules, still the same error. I have referred http://drupal.org/node/591684 and http://drupal.org/node/236969, but really don't know where to fix it.

Thanx,
Sridhar

Comments

vm’s picture

when you updated did you first disable all contributed modules?
did you first update all contrib modules to their lastest 5.x version before trying to move to D6 ?

sri20198’s picture

Yes. Infact, i was moving this site from 4.6.2. So first upgraded from 4.6.2 to 4.7 (including all contrib modules). Then from 4.7 to 5.2 along with all the modules with latest versions. Before i moved from 5.2 to 6.14, I disabled all non-core modules and then run update.php

Tom Ash’s picture

I'm getting the same error, and likewise can't find any reference to 'db_num_rows'.

(At least, definitely not in my modules and themes, which I have local copies of - I presume there wouldn't be any references elsewhere in Drupal, but am no expert in searching on my server. The best I could come up with was 'grep -iR 'db_num_rows' *' which didn't return any matches.)

sri20198’s picture

I rolled back my site to 5.2 and upgraded to 6.0 instead. Still get the same error - Fatal error: Call to undefined function db_num_rows() in D:\wamp\www\stest\includes\common.inc(1537) : eval()'d code on line 11.

I also installed a new site with Drupal 5.2. Created couple of nodes and then upgraded it to 6.14. It works very well.

So I am looking at this option - install a clean copy of D6 and import all of the content, users, terms, etc from the old site. Is there a module to do this?

Tom Ash’s picture

That's what I did in the first place, and I still have the problem

WorldFallz’s picture

Not sure why, but http://api.drupal.org/api/function/db_num_rows/5 is a function that no longer exists so it would appear you've got an incomplete upgrade hanging around somewhere-- or maybe it's cached. Go into the db and empty (not delete) all the cache* tables.

Tom Ash’s picture

It's not a caching error - do you have *any* idea how to diagnose the problem? Is there a debugger to cron, or some other way to see where this function is getting called?

WorldFallz’s picture

The other thing you can do is search all the files of the drupal install for 'db_num_rows'-- first place I would check is common.inc because that's what's mentioned in the error message.

sri20198’s picture

I used dreamweaver as well as windows explorer to search for the phrase "db_num_rows" in all of the files in the installation directory. None found. Very annoying.

WorldFallz’s picture

One other thought-- sqldump the db and search that as well. Could be in a custom block or node.

sri20198’s picture

Yes. It was lurking in one of the blocks. The user who created the block, had used custom code to get some content.

I took a sqldump, searched through it, converted the code to suit 6.x and the site came up.

Thanx a ton WorldFallz.

WorldFallz’s picture

Excellent-- glad we sorted it. But you let users enter code?????

sri20198’s picture

Its a community site and is administered by 3 persons from different cities. It was set up on 4.6 and has been running on it for more than 3 years. The db_num_rows code was put in a block long time ago by one of the admins.

Thanx for all the help.

Tom Ash’s picture

Worked for me too, thanks a bunch

sri20198’s picture

Yes. I have tried that too. I have truncated all cache tables and then tried logging in from another network (even to rule out any cookie / session issues), but no luck.

Incidentally, many have complained with similar errors (not the same though), when moving from D5 to D6 and in response quite a few answered blaming the Forum module. The usual method used has been disable forum module in D5 -> uninstall it in D5 -> copy D6 files & then run update -> then enable Forum module in D6. I would be trying that in some time and will post back if I am successful.