<button id="g80sy"></button>
  • <abbr id="g80sy"></abbr>
  • <button id="g80sy"></button>
    <rt id="g80sy"><delect id="g80sy"></delect></rt>
  • PHP如何使用mysql_connect鏈接MYSQL數據庫

    程序猿 2021-03-17 20:28:35 2439瀏覽 加載中

    php基本的鏈接mysql數據庫在函數為

    $c = mysql_connect("localhost","root","password");

    連上數據庫后,選擇數據庫

    $db = mysql_select_db('you_db'); //數據庫的名稱

    查詢數據庫,及打印數據

    $sql = "select * from you_table ";
    $res = mysql_query($sql);
    if (!$res) {    
        die("could get the res:\n" . mysql_error());
    }
    while ($row = mysql_fetch_assoc($res)) {    
        print_r($row);
    }

    關閉打開的數據庫

    mysql_close($con);


    標簽: php mysql
    最后修改:2025-05-30 00:29:34

    非特殊說明,本博所有文章均為博主原創。

    主站蜘蛛池模板: 旺苍县| 天长市| 西青区| 丹凤县| 深州市| 南通市| 青冈县| 论坛| 五台县| 绥德县| 沈阳市| 靖远县| 阜新| 开封县| 石台县| 广丰县| 东兴市| 永春县| 师宗县| 五原县| 类乌齐县| 航空| 隆安县| 西充县| 当阳市| 岱山县| 海南省| 淮南市| 昭苏县| 杭锦后旗| 锡林浩特市| 延川县| 宜兰市| 固原市| 区。| 屯昌县| 台江县| 红原县| 来凤县| 辛集市| 巧家县|