Re: 2 x DB connections at once

From: Date: Thu, 22 Jan 2004 22:58:53 +0000
Subject: Re: 2 x DB connections at once
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-175481@lists.php.net to get a copy of this message
You're running into an old error. I believe that this was a problem with previous versions of PHP, are you using the newest version? Barring that, if you add true to the end of the mysql_connect call to make it a different connection, that should also fix things. Or you could try using PEAR::DB or one of the other DB abstraction classes which will take care of all of that for you. http://pear.php.net/package/db Donald Tyler wrote:
OK, now I have done some work and it gets even stranger. Two Objects Validator Importer Both objects have private variables called $this->Connection However, when I change the DB for one objects connection pointer, the other objects connection pointer ALSO changes DB. Is it not possible to have two completely separate DB connections active at the same time? -----Original Message----- From: Donald Tyler [mailto:chekote69@hotmail.com] Sent: Thursday, January 22, 2004 3:08 PM To: php-general@lists.php.net Subject: [PHP] 2 x DB connections at once I thought this was possible, but it doesn't seem to be working: I have a class, that has a private variable called $this->Connection, which is a Database Connection pointer to a MySQL database. During the lifetime of the Class, it uses the connection multiple times without a problem. The class also uses a function from an include file that has its OWN Database Connection pointer. And it seems that for some reason, as soon as that external function is called, the Private Database Pointer within my Class suddenly points to the Database name that the external functions Database Pointer was using. I ALWAYS specify which connection pointer I want to use when selecting the DB and doing a mysql_query, so I have no earthly idea how the external Connection pointer is affecting my Private Connection Pointer. I hope I explained that well enough; it's real difficult to put into words. Does anyone have any idea what might be happening?
-- paperCrane <Justin Patrin>

« previous php.general (#175481) next »