Cross-database join queries, expanding on Dan Ross's post...
Really, this is a mysql specific feature, but worth noting here. So long as the mysql user has been given the right permissions to all databases and tables where data is pulled from or pushed to, this will work. Though the mysql_select_db function selects one database, the mysql statement may reference another (the syntax for referencing a field in another db table being 'database.table.field').
<?php
$sql_statement = "SELECT
PostID,
AuthorID,
Users.tblUsers.Username
FROM tblPosts
LEFT JOIN Users.tblUsers ON AuthorID = Users.tblUsers.UserID
GROUP BY PostID,AuthorID,Username
";
$dblink = mysql_connect("somehost", "someuser", "password");
mysql_select_db("BlogPosts",$dblink);
$qry = mysql_query($sql_statement,$dblink);
?>