[wp-hackers] WP and Plugins DB connection conflicts
paul at codehooligans.com
Wed Jun 27 14:26:29 GMT 2007
On Jun 27, 2007, at 8:55 AM, Omry Yadan wrote:
>> I'd be interested to know what these cases are, because I can't think
>> of any. Plugins already have the $wpdb connection available to them,
>> why would they ever need to make another connection to the same DB?
> FireStats for example, does not depend on WordPress (it can work as
> standalone), so it has its own database infrastructure.
Is this for the FireStats stand-alone implementation? Regardless, I
think the rule should be don't mess with the global $wpdb object. Use
it but don't try to manipulate it. End of issue.
If you want/need to create your own connection (dumb in my opinion)
then create your own instance of the WPDB class.
// From inside your plugin
// You will need to make sure wpdb.php is included.
$my_wpdb = new wpdb($USER, $PASSWORD, $NAME, $HOST);
More information about the wp-hackers