I use muliple databases all the time, and you don't really need to switch between them, just open them with different resource id's, and specify the resource link identifer in your queries. ( I accually always write my queries that way, incase I need to connect to a different database later on in development )
$db1 = mysql_connect('localhost','myuserid','mypasswd');
$sel1 = mysql_select_db('db01');
$db2 = mysql_connect('localhost','myuserid','mypasswd');
$res1 = mysql_query($query, $db1);
$res2 = mysql_query($query, $db2);
note: then you also need to use the resource link idenitifier in functions like, mysql_affected_rows($db1), mysql_insert_id($db1), mysql_error($db1), etc...