一个连接两个不同MYSQL数据库的PHP程序

HTMLBODY BGCOLOR=FFFFFF ?php echo “Connecting as mysqlBR”; $connection1
= mysql_澳门新浦京娱乐游戏,connect(localhost, mysql, ) or die($php_errormsg); echo
“connection1 is $connection1BR”; echo “Selecting test for mysql userBR”;
mysql_select_db(test, $connection1) or @die(“Error ” . $php_errormsg
. mysql_error()); echo “Connection as joyceBR”; $connection2 =
mysql_connect(localhost, joyce, ) or die($php_errormsg); echo
“connection2 is $connection2BR”; echo “Selecting books for joyce
userBR”; $db2 = mysql_select_db(techbizbookguide, $connection2) or
die(mysql_error()); $query1 = “select foo from test”; $query2 = “select
title, authorFirst, authorLast from bookinfo”; echo “Querying testBR”;
$users = mysql_query($query1, $connection1) or die(mysql_error());
echo “Querying booksBR”; $books = mysql_query($query2, $connection2) or
die(mysql_error()); echo “Foos from testBR”; while (list($foo) =
mysql_fetch_row($users)){ echo $foo, “BR”; } echo “Books in
techbizbookguideBR”; while (list($title, $authorFirst, $authorLast) =
mysql_fetch_row($books)){ //Use trim in case we have a book by
“Madonna” or “Prince” or… echo $title, by , trim($authorFirst . .
$authorLast), “BR”; } ? /BODY/HTML

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图