Forum Moderators: coopster
This conn DB2
$db2 = new MySQL_Db2;
$db2->connect($host, $un, $pw);
$db2->query($db_db2);
$result = $db2->query("
SELECT.......
How will I go to combine the two conns in order to perform a join on the separated DBs
to use for ex: select * db.tb1 join db2.tb2 on tb1.id=tb2.id
of course I may do that directly from that script, but I do not feel secure by having my DB details showing up in the same page/script
Is there a way to write a routine that within one select could call two Db?
I do not think so...
However, if both databases are on the same server and the user has authority/permission to access both databases, you can then use a single connection and specify the databases in your query ...
SELECT database1.table.field1, database2.table.field2 FROM database1.table INNER JOIN database2.table ON (database1.table.primarykey = database2.table.foreignkey);