Is it possible to have multiple databases open in MySql using PHP. I can't access 2 databases simultaneously using the following code any suggestions?
$dbhost = "localhost";
$dbuser = "user";
$dbpass = "pass";
$db1 = "db1";
$db2 = "db2";
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass);
@mysql_select_db($db1);
if (!$dbcnx) { echo( "<P>Unable to connect to the database server at this time.</P>" ); exit(); }
if (! @mysql_select_db($dbname) ) { echo( "<P>Unable to locate the Information database at this time.</P>" ); }
@mysql_select_db($db2);
if (!$dbcnx) { echo( "<P>Unable to connect to the database server at this time.</P>" ); exit(); }
if (! @mysql_select_db($dbname) ) { echo( "<P>Unable to locate the Information database at this time.</P>" ); }
$dbhost = "localhost";
$dbuser = "user";
$dbpass = "pass";
$db1 = "db1";
$db2 = "db2";
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass);
@mysql_select_db($db1);
if (!$dbcnx) { echo( "<P>Unable to connect to the database server at this time.</P>" ); exit(); }
if (! @mysql_select_db($dbname) ) { echo( "<P>Unable to locate the Information database at this time.</P>" ); }
@mysql_select_db($db2);
if (!$dbcnx) { echo( "<P>Unable to connect to the database server at this time.</P>" ); exit(); }
if (! @mysql_select_db($dbname) ) { echo( "<P>Unable to locate the Information database at this time.</P>" ); }