Select data from two different databases



I have 2 databases (with different user names and different
passwords), and I need to join column_1 from table_A (on first
database: database_I) on column_2 from table_B (on second database:
database_II).
How query should likes? I want to do this in php - where should I
specify different user names and diffrent passwords for databases?


<?php
$dbhost="server_name\instance_name,port_number";
$dbuser1="user1";
$dbuser2="user2";
$dbpass1="password1";
$dbpass2="password2";
$dbname1="database_I";
$dbname2="database_II";
$db1=mssql_connect($dbhost,$dbuser1,$dbpass1);
$db2=mssql_connect($dbhost,$dbuser2,$dbpass2);
mssql_select_db($dbname1,$db1);
mssql_select_db($dbname2,$db2);
$query="SELECT...";


?>
.



Relevant Pages

  • Re: How to get enum values from MySQL column using PHP?
    ... Ever worked with databases in PHP? ... Also avoid the @ operator to suppress error messages - if something goes ... wrong with the query, you'll never know why. ...
    (comp.lang.php)
  • Re: Select data from two different databases
    ... How query should likes? ... I want to do this in php - where should I ... specify different user names and diffrent passwords for databases? ...
    (comp.lang.php)
  • Re: [PHP] Getting mysql_query results into an array
    ... loop through mysql result set to build $array ... perform some kind of calculation upon $array ... Databases are highly optimized for this kind of thing, ... query is nasty and the PHP is fast and easy, ...
    (php.general)
  • Re: [PHP] Getting mysql_query results into an array
    ... perform some kind of calculation upon $array ... it's USUALLY much more efficient to write an SQL query ... Databases are highly optimized for this kind of thing, ... query is nasty and the PHP is fast and easy, ...
    (php.general)
  • RE: [PHP] Microsoft .NET arguement
    ... I've found MS SQL (and MS Access databases) to be extremely fast ... have them installed alongside PHP for Win32. ... MySQL started slowing down before the MS SQL did. ...
    (php.general)