Well, you can do that or you can have two separate variables. Either way, I suppose. Just make sure you're passing the correct resource to the correct query.
$connection = array();
$connection['database1'] = mysql_connect('localhost', 'user1', 'pass1', TRUE);
$connection['database2'] = mysql_connect('localhost', 'user2', 'pass2', TRUE);
if(!mysql_select_db('database1', $connection['database1']))
die('MySQL error: ' . mysql_error($connection['database1']));
if(!mysql_select_db('database2', $connection['database2']))
die('MySQL error: ' . mysql_error($connection['database2']));
// etc.