A little note about multiple simultaneous connections to different hosts...
I work on a site that pulls content primarily from one db but uses a db on a foreign server to verify licensing. One might expect the following to work:
<?php
$res1 = mysql_connect($host1, $user1, $pass1);
mysql_select_db($db1);
$res2 = mysql_connect($host2, $user2, $pass2);
mysql_select_db($db2, $res2);
mysql_query($check_sql, $res2);
mysql_close($res2);
mysql_query($query);
?>
Turns out this last query, since it cant find an active connection, will try to connect with mysql_connect() with no paramaters. But if instead you do it as mysql_query($query, $res1), or alternatively, run the mysql_connect for this host again then it works fine. Thus, it doesnt seem to be possible to have code with an overarching "global" db connection interspersed with temporary connections to another host/db....