You can make multiple calls to mysql_connect(), but if the parameters are the same you need to pass true for the '$new_link' (fourth) parameter, otherwise the same connection is reused.so then you have$dbh1 = mysql_connect($hostname, $username, $password); $dbh2 = mysql_connect($hostname, $username, $password, true); mysql_select_db('database1', $dbh1);mysql_select_db('database2', $dbh2);Then to query database 1,…