:::

6-3 上課範例:index.php

<?php
error_reporting(0);
$link=@mysql_connect("localhost" , "tad0616" ,"12345");

if(!$link)  echo "資料庫連不上!";

//設定使用UTF8編碼
mysql_query("SET NAMES 'utf8'");

//選擇資料庫
mysql_select_db('tad0616');

//設定SQL語法
$sql="select * from tncomu_class";

//執行SQL語法
$result = mysql_query($sql) or die("無法執行:".mysql_error());

$main="<table border=1>";
while($data=mysql_fetch_assoc($result)){
  $main.="
  <tr>
  <td>{$data['class_sn']}</td>
  <td>{$data['seme']}</td>
  <td>{$data['subject']}</td>
  <td>{$data['class_name']}</td>
  <td>{$data['teacher']}</td>
  <td>{$data['passwd']}</td>
  <td>{$data['access']}</td>
  </tr>";
}
$main.="</table>";

echo $main;
//mysq_fetch_row()
//mysq_fetch_array()
?>
 


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D523%26tbsn%3D20

書籍目錄

展開 | 闔起

線上使用者

32人線上 (16人在瀏覽線上書籍)

會員: 0

訪客: 32

更多…