<?php
// 建立 MySQL 資料庫的連線
$connection = mysql_connect('localhost', 'root', '123');
if (!$connection) {
  die ('無法建立MySQL資料庫的連線');
}
// 設定在用戶端使用UTF-8的字元集
mysql_set_charset('utf8', $connection);
// 選擇 MySQL 資料庫ch21
$db_selected = mysql_select_db('ch21', $connection);
if (!$db_selected) {
  die ('無法使用ch21資料庫 : ' . mysql_error());
}

//
$result = mysql_query("select * from `class` where `id`= '2'");

// 顯示每一筆紀錄
?>
<table>
<?php
        while(($row_result=@mysql_fetch_assoc($result)))
        {
        echo "<tr>";
        echo "<td>".$row_result["name"]."</td>";
        echo "<td>".$row_result["address"]."</td>";
        
        echo "</tr>";
        }


?>
</table>

arrow
arrow
    全站熱搜

    JL8051 發表在 痞客邦 留言(0) 人氣()