Re: Major Bug in multiple MySQL Connections?

From: Date: Mon, 22 Apr 2002 17:19:48 +0000
Subject: Re: Major Bug in multiple MySQL Connections?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-83148@lists.php.net to get a copy of this message
At 17:27 22-4-2002, Rasmus Lerdorf shared with all of us:
The proper way to do this in your generalized app would be to either force a mysql_select_db on each query to make sure you are talking to the right one, or if you prefer do a select database() query to see which is the current one.
??? If this is the case, then don't deprecate mysql_db_query. If keeping track of dbconnection is such a problem, simply hardcode the database in the query. Then it doesn't matter what db is currently selected.
    Also, honestly, I do not understand why PHP _forces_ you to
    reuse the same links. Until the patch/optional parameter the
    only workaround was to use another username (doh!).
Actually - using different variables, with different hostnames already work. Ie: localhost / 127.0.0.1 are different. I use it in a forum app, where registration is in centralized in another database. I can use IP, short hostname, FQDN, so three at one time if I want to. Ex: $con1=mysql_connect("localhost","user","pw"); mysql_select_db("db1", $con1); $con2=mysql_connect("127.0.0.1", "user","pw"); mysql_select_db("db2", $con2); Met vriendelijke groeten / With kind regards, IDG.nl Melvyn Sopacua Webmaster

« previous php.dev (#83148) next »