1.两个MySQL数据库的操作:
<?php $conn = mysql_connect('localhost','root','admin888') or die(mysql_error()); $db = mysql_select_db('mydb') or die(mysql_error()); $db2 = mysql_select_db('mydb2') or die(mysql_error()); mysql_query("set names utf8"); $res = mysql_query("select mydb.user.name from mydb.user union select mydb2. user.name from mydb2.user"); $row = mysql_fetch_assoc($res); var_dump($row); ?>