Instruct ICC wrote:
From: Joaquín <javalpi@xxxxxxxxx>
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/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php