php连接多数据库

<?php 

$conn1=mysql_connect('localhost','root','','new_link ');
$conn2=mysql_connect('localhost','root','','new_link ');
 
mysql_select_db('111',$conn1);
mysql_select_db('test',$conn2);
 
$sql1="select * from g4_member";
$sql2="select * from subject";



$rest1=mysql_query($sql1,$conn1);
$rest2=mysql_query($sql2,$conn2);
$num=mysql_fetch_array($rest1);
$Row=mysql_fetch_array($rest2);
 
 
print_r($Row);
echo("<br><br><br>");
print_r($num);

?>

 

你可能感兴趣的:(多数据库)