Re: RE: Best Practices? [PHP-DB] Queries from two databases

From: Date: Thu, 19 Jul 2007 23:05:03 +0000
Subject: Re: RE: Best Practices? [PHP-DB] Queries from two databases
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43817@lists.php.net to get a copy of this message
Instruct ICC wrote:
From: Joaquín <javalpi@gmail.com> I need query tables that are in two different databases mysql_select_db("DB1", $conn_1); mysql_select_db("DB2", $conn_2); $result_t1 = mysql_query("SELECT * FROM Table1inDB1",$conn_1); $row_t1 = mysql_fetch_assoc($result_t1); $result_t2 = mysql_query("SELECT * FROM Table2inDB2",$conn_2); $row_t2 = mysql_fetch_assoc($result_t2);
Although Joaquín said his issue is [Fixed], I write these queries as: SELECT * FROM DB1.TableInDB1 SELECT * FROM DB2.TableInDB2 (with and without link_identifiers I believe), so I was wondering about best practices.
If you only ever deal with mysql then you'll be fine. Other databases may or may not support this feature. The other problem could be user 'A' has access to DB1 but no access to DB2. So you have to connect as user 'B' to be able to read from DB2. So - as usual - "it depends" is the answer. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#43817) next »