[wp-hackers] List of constants

John Blackbourn johnbillion+wp at gmail.com
Tue Sep 29 19:22:37 UTC 2009


It's really easy.

$mydb = new wpdb( [user], [password], [db name], [db host] );

and then just use $mydb where you would normally use $wpdb.

2009/9/29 Sharon Chambers <sharon at brewerradio.com>:
> Ooh!  Could it be possible I'm going about something the wrong way? :P
>
> I have multiple WP installations on the same server/same db...different domains...sharing some event data.  I have done things the hard way between the two, haven't I?  Instead of creating a new wpdb instance, I directly modified the post/postmeta tables to propagate this data from one installation to the other.  (Even though I was mildly aware that this wasn't good form, I opted for quick and dirty--never a good idea.)
>
> Anything I would need to keep in mind if creating another instance of wpdb?  I already have my code setup as a plugin on one server, with an admin option screen to give the name of the other install's prefix...
>
> Thanks, Otto (and Ozh for the inquiry)!
> -Sharon
>
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Otto
> Sent: Tuesday, September 29, 2009 2:43 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] List of constants
>
> It's possible you might want to create a new instance of wpdb at some
> point and connect it to another set of tables (in the same database).
>
> Constants can't be redefined during runtime. Globals can.
>
> -Otto
>
>
>
> On Tue, Sep 29, 2009 at 1:36 PM, Ozh <ozh at planetozh.com> wrote:
>> On Tue, Sep 29, 2009 at 7:44 PM, Otto <otto at ottodestruct.com> wrote:
>>> A fair number of the ones that matter are listed in this article:
>>> http://codex.wordpress.org/Editing_wp-config.php
>>>
>>
>> Something I've never wondered before: any reason $table_prefix is a
>> var while all other stuff are consts? Or is it just legacy?
>>
>> --
>> http://planetOzh.com ~ Blog and WordPress Stuff
>> http://FrenchFragFactory.net ~ Daily Quake News
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list