In PHP code I open 2 connection to 2 different databases (on different hosts).
PHP Code:
$dbh1 = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db('database1', $dbh1);
mysql_query('select * from tablename', $dbh1);
/*
and for database 2
*/
$dbh2 = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db('database2', $dbh2);
mysql_query('select * from tablename', $dbh2);
That works just fine.
However, if connection to first DB - $dbh1 - fails, then I can see only error and no data form $dbh2.
Actually nothing what is below $dbh1 is displayed. Even test message like: print "test";
Why is it like this and what to do to make it works?
My system details:
Code:
Apache/2.2.17 (Unix) DAV/2 PHP/5.3.6
mysql Ver 14.14 Distrib 5.1.56, for slackware-linux-gnu (i486) using readline 5.1