Multi-DB causing strange warnings

Hi gang,

Yesterday, I upgraded my WPMU installation to WP3, and I've been going through and updating all my mu-plugins as well.

I activated the latest version of Multi-DB, and everything works except for a few strange errors when accessing these pages:

SuperAdmin >> Users (/wp-admin/ms-users.php)
Dashboard >> My Sites (/wp-admin/my-sites.php)

Here is the error. When I access these two pages, this error repeats 20 times or more:

Warning: mysql_real_escape_string(): 15 is not a valid MySQL-Link resource in
 /home/ACCOUNT_NAME/public_html/wp-includes/wp-db.php on line 785

So, I checked the /wp-includes/wp-db.php file, and found this subroutine on line 785:

function _real_escape( $string ) {
if ( $this->dbh && $this->real_escape )
  return mysql_real_escape_string( $string, $this->dbh );
  return addslashes( $string );

I've tried several things to troubleshoot these errors, and I'm out of ideas at this point.
1. Disabled all /mu-plugins/
2. Disabled all /plugins/
3. Re-installed Wordpress files
4. Re-installed Multi DB plugin
5. Checked db-config.php file
6. Upgraded databases

Any ideas? The only other clue I could find (which leads me to believe this is a Multi DB thing) is this error:

Warning: mysql_error(): 15 is not a valid MySQL-Link resource in
/home/ACCOUNT_NAME/public_html/wp-content/db.php on line 291

See attached images as well. Any ideas?

  • nickd32
    • The Incredible Code Injector

    One note -- I don't know if this has anything to do with the issue, but WP3 doesn't give the primary blog tables a number anymore like WPMU did. It used to be:

    wp_1_comments (etc)

    But now it's:

    wp_comments (etc)

    Thus, the main blog doesn't fit within the Multi-DB hash and must be moved to the 'global' database.

    I had to move the main blog tables to the 'global' database and rename each table to remove the _1_ part in order to get it to work at all.

    Still seeing the errors described in the post above...

  • nickd32
    • The Incredible Code Injector

    I think I've isolated this issue to the wp_users table. It seems that if I delete the users of the sites causing the errors, and then re-create those users, the issue goes away.

    Not sure why. Has anyone seen this before?

  • Mason
    • DEV MAN’s Sidekick


    I've done an install of multi-db since the 3.0 WordPress release and didn't run into this issue (though you are correct about the lack of Blog_ID for primary site. I'll ask a couple of the devs to come by and check into this with you. Apologies for the lack of response on this one til now.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.