I have to insert data in two different database\'s table. I have created database1 and table1 for database1, also i have created database2 and table2 for database2.
For
first create two database connections
$connect1 = mysql_connect("localhost","root","");
$connect2 = mysql_connect("localhost","root","");
Then select the database for each connection.
mysql_select_db("database1",$connect1); // select database1
mysql_select_db("database2",$connect2); // select database2
Then pass in a second argument for mysql_query
which is the respective connection for the query.
mysql_query("SELECT ... ", $connect1);
mysql_query("SELECT ... ", $connect2);