<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 2273瀏覽 加載中

    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-03-23 19:23:43

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

    主站蜘蛛池模板: 建水县| 资中县| 冷水江市| 宿州市| 石泉县| 静乐县| 博兴县| 陆川县| 安远县| 洛隆县| 滦南县| 潍坊市| 锡林浩特市| 色达县| 应城市| 邢台市| 阳泉市| 安多县| 沁水县| 水城县| 襄樊市| 肃南| 邯郸县| 田林县| 策勒县| 天津市| 易门县| 都兰县| 吴堡县| 印江| 青河县| 澄迈县| 涟水县| 临泉县| 香港| 浪卡子县| 云林县| 商河县| 凭祥市| 新竹县| 客服|