PEAR with multiple databases
| From: | Valerio Santinelli | Date: | Fri, 01 Mar 2002 16:03:26 +0000 |
| Subject: | PEAR with multiple databases | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-924@lists.php.net to get a copy of this message | ||
I am trying to use more than one DB connection in the same script, but I'm experienceing every
kind of problems.
By default I'm connected to my application's main database, but at a certain point I need
to fetch some data from a different database.
What I am doing is instantiating a new DB connection through DB::connect() passing as parameter the
new DSN.
At this point I can do all my operations on the new db, but my old connection gets transferred to
the new one and I can no longer access the first db.
Example:
$db = DB::connect($dsn);
... do some queries ...
$other_db = DB::connect($second_dsn);
.. do some queries on $other_db ...
.. do some queries on $db
^^^
At this point, when I try to query the first DB, instead I am still querying $other_db, like if the
connection was transferred to the other DB.
Any idea of what to do to overcome this problem?
I am using PEAR's version coming with PHP 4.1.2
--
Valerio Santinelli
HateSeed.com Founder (http://www.hateseed.com)
In Flames Italia Webmaster (http://www.inflames.it)
My Lab (http://tanis.hateseed.com)