if your trying to query one database using fields from another you could but you'd need to know the fields before hand. Return the first database result as an associative array and us that in your second query. If you return both as the same array it should add the data together.
PHP Code:
<?php
$C1 
= @mysql_connect('localhost','pein87','password');
$C2 = @mysql_connect('localhost:81','pein87','password');

$DB1 = @mysql_select_db('boo',$C1);
$DB2 =@mysql_select_db('boo'$C2);

$Q1 = @mysql_query("SELECT * FROM ghosts");

$ghostData = @mysql_fetch_assoc($Q1);

$Q2 = @mysql_query("SELECT * FROM ghostLocation WHERE '"$ghostData[HauntingType] ."' = 'demonic'");

$ghostData[] = @mysql_fetch_assoc($Q2);

echo 
$ghostData;

?>
This should work but of course you'll need to tweak your SQl statements though. What it will do is add more indexes to the $ghostData array. Knowing the fields of each table being called is essential for this to work though. I don't use array_merge() because of the overhead of calling a function when using $array_name[] = $Blah works better and faster. I hope this works out for you and as a rule of thumbs you'll need both connections because the mysql_select_db() will use the current active connection if you don't tell it which one to use.