Re:

From: Date: Wed, 10 Dec 2003 00:38:27 +0000
Subject: Re:
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9436@lists.php.net to get a copy of this message
Philip Shafer wrote:
Can somebody give me a run down on how to use the DB package with multiple databases? Do I have to connect and disconnect every time I want to use a different databases or can I just create multiple database connections which can remain open until the program exits? I'd like to be able to do the following: $datasources['headlines']['DSN']="mysql://some dsn"; $datasources['press']['DSN']=" mysql://some dsn"; $datasources['events']['DSN']="mysql://some dsn" $datasources['headlines']['DBH']= DB::connect($datasources['headlines']['DSN'], true); $datasources['press']['DBH']= DB::connect($datasources['press']['DSN'], true); $datasources['events']['DBH']= DB::connect($datasources['events']['DSN'], true); I'd like to be able to use any DBH I need when ever I wanted? Is this possible? Right now, when ever I try to execute a query it runs the query on the database which was last connected to. -phil ------------------ Philip Shafer Web Programmer Information Resources Rowan University 856-256-4418 shafer@rowan.edu
I've had no problems myself. Could you give us more info? For instance, are all of the databases on the same server? Are you specifying a database in your DSN? You could also try using =& when creating the DB instances. -- paperCrane <Justin Patrin>

« previous php.pear.general (#9436) next »