Connecting 2 database
Posted: Thu Oct 25, 2007 6:37 am
How to connect to 2 database from different server. I have to display client_details on the left side and blog_details on the right side on the same page. client_details and blog_details tables are in different databases. say db1 and db2.
Config file details:
Config file details:
Code: Select all
<?php
$host = 'host1';
$username = 'user1';
$password ='password1';
$database='db1';
$link=mysql_connect($host, $username, $password);
mysql_select_db($database, $link);
$host2 = 'host2';
$username2= 'user2';
$password2 ='password2';
$database='db2';
$blog_link=mysql_connect($host2, $username2, $password2);
$blog_database='db2';
mysql_select_db($blog_database, $blog_link);
?>