function connect($dbhost, $dbuser,$dbpass, $dbname){
$connection = mysql_conect($dbhost,$dbuser,$dbpass)
mysql_selsect_db($dbname, $connection);
return $connection;
}
$koneksi_komputer_A = connect('ip_computer_a','user','password','db1');
$koneksi_komputer_B = connect('ip_computer_b','user','password','db2');
$sql = "select * from nama_table";
//baca data komputer a
$data_komp_a = mysql_query($sql, $koneksi_komputer_A);
//baca data komputer b
$data_komp_b = mysql_query($sql, $koneksi_komputer_B);