国产探花免费观看_亚洲丰满少妇自慰呻吟_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>  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南开区| 仁布县| 天全县| 五寨县| 阳泉市| 大洼县| 磐安县| 安陆市| 平塘县| 平武县| 吴忠市| 黑河市| 深泽县| 滕州市| 休宁县| 玉田县| 吉安市| 依安县| 特克斯县| 昌都县| 驻马店市| 湘西| 呼玛县| 建始县| 凯里市| 西乡县| 辽宁省| 沙湾县| 乡宁县| 汪清县| 资阳市| 太谷县| 互助| 泸西县| 清丰县| 丽水市| 黎平县| 新兴县| 南木林县| 巴中市| 天门市|