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);

?>

 

posted @ 2013-07-03 14:12  神马和浮云  阅读(344)  评论(0编辑  收藏  举报