:::

4-1 index.php

<?php
$root_pass="12345";    //資料庫root密碼
$db_name="test";  //資料庫名稱

/* 連資料庫檢查 */
$link=mysql_connect("localhost","root",$root_pass);  //資料庫連線
mysql_select_db("test");
mysql_query("SET NAMES 'utf8'");  //設定語系
error_reporting(0);

$sql="select * from course";
$result=mysql_query($sql);
while(list($c0,$c1,$c2,$c3,$c4,$c5,$c6)=mysql_fetch_row($result)){
    $tbody.="<tr><td>$c0</td><td>$c1</td><td>$c2</td><td>$c3</td><td>$c4</td><td>$c5</td><td>$c6</td></tr>";
}


?>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title></title>
  </head>
  <body>

    <link rel="stylesheet" href="tinytable/tinytable.css" />
    <table id="my_table" class="tinytable">
    <thead>
      <tr>
        <th style="width:60px"><h3>編號</h3></th>
        <th style="width:100px"><h3>開課單位</h3></th>
        <th style="width:100px"><h3>學程</h3></th>
        <th><h3>課程名稱</h3></th>
        <th style="width:60px"><h3>人數</h3></th>
        <th style="width:70px"><h3>學分數</h3></th>
        <th style="width:70px"><h3>星期幾</h3></th>
      </tr>
    </thead>
    <tbody>
        <?php echo $tbody;?>
    </tbody>
  </table>
  <div style="width:980px;margin:10px auto;">
        共 <span id="totalpages"></span> 頁
        <img src="tinytable/images/first.gif"  alt="最前頁" onclick="sorter.move(-1,true)" />
        <img src="tinytable/images/previous.gif"  alt="上一頁" onclick="sorter.move(-1)" />
        <span id="currentpage"></span>
        <img src="tinytable/images/next.gif" alt="下一頁" onclick="sorter.move(1)" />
        <img src="tinytable/images/last.gif" alt="最後頁" onclick="sorter.move(1,true)" />
        <select id="columns" onchange="sorter.search('query')" style="width:80px;"></select>
      <input type="text" id="query" onkeyup="sorter.search('query')" size=8 />
      共 <span id="totalrecords"></span> 筆資料,目前顯示第 <span id="startrecord"></span>~<span id="endrecord"></span> 筆資料
        <a href="javascript:sorter.reset()">重來</a>
       
        <a href="javascript:sorter.showall()">顯示全部</a>
       
        <select onchange="sorter.size(this.value)">
            <option value="5">5</option>
            <option value="10">10</option>
            <option value="15">15</option>
            <option value="20">20</option>
            <option value="50">50</option>
        </select>
  </div>

<div style="display:none;">
<div id="tablenav">切換到第 <select id="pagedropdown"></select> 頁</div>
</div>

<script type="text/javascript" src="tinytable/script.js"></script>
<script type="text/javascript">
var sorter = new TINY.table.sorter('sorter','my_table',{
headclass:'head',
ascclass:'asc',
descclass:'desc',
evenclass:'evenrow',
oddclass:'oddrow',
evenselclass:'evenselected',
oddselclass:'oddselected',
paginate:true, size:10,
colddid:'columns',
currentid:'currentpage',
totalid:'totalpages',
startingrecid:'startrecord',
endingrecid:'endrecord',
totalrecid:'totalrecords',
hoverid:'selectedrow',
pageddid:'pagedropdown',
navid:'tablenav',
sortcolumn:0,
sortdir:1,
sum:[4,5],
avg:[4,5,6],
columns:[{index:4,format:'人',decimals:0},{index:5,format:'節',decimals:0}],

init:true
});
</script>

  </body>
</html>
 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fmail.tad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D248%26tbsn%3D9

書籍目錄

展開 | 闔起

線上使用者

374人線上 (155人在瀏覽線上書籍)

會員: 0

訪客: 374

更多…