<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

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

    主站蜘蛛池模板: 永兴县| 彭水| 南江县| 辉县市| 邵武市| 巴彦淖尔市| 佛教| 观塘区| 铜鼓县| 德钦县| 上犹县| 武夷山市| 邮箱| 武宁县| 赞皇县| 揭东县| 伊宁县| 峡江县| 金寨县| 米易县| 宜州市| 永德县| 柳江县| 绩溪县| 宜兰县| 湟源县| 马龙县| 濮阳县| 高唐县| 固始县| 石狮市| 白玉县| 迁安市| 永兴县| 上蔡县| 孟州市| 淅川县| 儋州市| 宿松县| 象山县| 乌鲁木齐市|