国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

一個連接兩個不同MYSQL數據庫的PHP程序

2024-07-24 12:56:40
字體:
來源:轉載
供稿:網友
,歡迎訪問網頁設計愛好者web開發。<html><body bgcolor=ffffff>  
<?php  
    echo "connecting as mysql<br>/n";  
    $connection1 = mysql_connect('localhost', 'mysql', '') or die($php_errormsg);  
    echo "connection1 is $connection1<br>/n";  
    echo "selecting test for mysql user<br>/n";  
    mysql_select_db('test', $connection1) or @die("error " . $php_errormsg . mysql_error());  
    echo "connection as joyce<br>/n";  
    $connection2 = mysql_connect('localhost', 'joyce', '') or die($php_errormsg);  
    echo "connection2 is $connection2<br>/n";  
    echo "selecting books for joyce user<br>/n";  
    $db2 = mysql_select_db('techbizbookguide', $connection2) or die(mysql_error());  
    $query1 = "select foo from test";  
    $query2 = "select title, authorfirst, authorlast from bookinfo";  
    echo "querying test<br>/n";  
    $users = mysql_query($query1, $connection1) or die(mysql_error());  
    echo "querying books<br>/n";  
    $books = mysql_query($query2, $connection2) or die(mysql_error());  
    echo "foos from test<br>/n";  
    while (list($foo) = mysql_fetch_row($users)){  
        echo $foo, "<br>/n";  
    }  
    echo "books in techbizbookguide<br>/n";  
    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>/n";  
    }  
?>  
</body></html>  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 龙口市| 那曲县| 平舆县| 太谷县| 临漳县| 曲阳县| 新竹市| 贞丰县| 张家港市| 昂仁县| 南丰县| 桃江县| 静海县| 北票市| 德安县| 张北县| 康马县| 方城县| 泾川县| 广饶县| 喀喇沁旗| 徐水县| 九龙坡区| 岢岚县| 库车县| 比如县| 柘城县| 瓮安县| 绥芬河市| 六枝特区| 兴文县| 张家港市| 沐川县| 高尔夫| 绥化市| 吉安市| 田东县| 霞浦县| 彩票| 湘潭县| 利津县|