[HyperDB] Two Database Configuration

astina at landofshadow.net astina at landofshadow.net
Sun Jul 25 01:26:07 UTC 2010


I seem to have gotten things connected to allow the site to 'work'.   
However, I'm trying to use the HyperDB functionality to connect to a  
second database on the same server with the intent of pulling data for  
a plug-in from it.

$wpdb->add_database(array(
         'host'     => 'localhost',
         'user'     => 'username',
         'password' => 'password',
         'name'     => 'wp_database',
));
$wpdb->add_database(array(
         'host'     => 'localhost',
         'user'     => 'username',
         'password' => 'password',
         'name'     => 'plugin_database',
         'dataset'  => 'plugin_dataset',
));

Whenever I try to do:

$myrows = $wpdb->get_results( "SELECT * FROM account" );

Account is a table in the plugin_database.  I get the following error:

Fatal error: Call to a member function get_results() on a non-object  
in  
/srv/web/www.landofshadow.net/public_html/wp-content/plugins/eden/eden.php on  
line 15

Any tips as to how I actually configure or utilize this correctly?   
Assistance with this would be "greatly" appreciated.

Astina
astina at landofshadow.net


More information about the HyperDB mailing list