Creating new wpdb Object
-
Hello,
For my Plugins and Widget I want to allow(as already some requests hit my mailbox) that you’re able to connect to other databases, which are maybe not accessable with the wp user and or on another host.
Therefor I’m creating my own wpdb instance.
With this line:
$phpbbdb= new wpdb($pBBuser, $pBBpassword, $pBBdb, $pBBhost);
Within my Plugin it’s all working fine. But if after my Plugin are some plugins,widgets or something else which uses tables i get errors like this(if my wpdb instance uses another db than the wordpress one):
TABLE xyz doesn't exist in this database
So as it seems the $wpdb holds then the same connection as $phpbbdb does, but that shouldn’t be as they’re different instances of the wpdb-class?
So I need to place at the end of my plugin this line:
$phpbbdb= new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
Can someone tell me what causes this problem, which in my opinion shouldn’t be?
Thank you for your help!
- The topic ‘Creating new wpdb Object’ is closed to new replies.