, 2 . - :
SELECT * FROM db2.tags WHERE id IN(SELECT id FROM db1.tags WHERE id=1)
This way you can compare both databases without two connections.
Now, if you do not have both in one place, you can do something like this:
mysql_select_db(db1);
$db1Result = mysql_query("SELECT * FROM db1.tags WHERE id=1");
mysql_select_db(db2);
$db2Result = mysql_query("SELECT * FROM db2.tags WHERE id=1");
And after that, compare the results from $ db1Result with the tags from $ db2Result.
source
share