php連線多資料庫

神馬和浮雲發表於2013-07-03
<?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);

?>

 

相關文章