I’ve literally spent half a day trying to find a solution for this problem.
From one WordPress installation I need to query multiple other WordPress installations’ databases.
I’d very much like to use the $wpdb way, as this is what I’ve always used (just haven’t ever had the need to access more than one database).
I’ve created a wpdb object by using this method:
$new_db_connection = new wpdb(*DB INFORMATION INSERTED HERE*)
However, as stated on WordPress’ own site, only one wpdb connection can exist at a time.
The $wpdb object can talk to any number of tables, but only to one database at a >time; by default the WordPress database. In the rare case you need to connect to >another database, you will need to instantiate your own object from the wpdb >class with your own database connection information.
My question to you guys is: How do I create a new wpdb object after the first? It doesn’t work to unset() the first database.
Read more here: How to create more than one $wpdb object in WordPress