Presentation is loading. Please wait.

Presentation is loading. Please wait.

分頁.

Similar presentations


Presentation on theme: "分頁."— Presentation transcript:

1 分頁

2 分頁 先取得總筆數與總頁數 $num=mssql_num_rows($result); // 取得 總列數 $pages=0;
$page=$_GET[“page”]; //使用者選擇之頁數 if ($num){ $pages=intval($num/10)+1; //總頁數 if ($page<1) $page=1; //$page:目前頁數 $pages:總頁數 if ($page>$pages) $page=$pages; mssql_data_seek($result,($page-1)*10); //重新取的資料 }

3 分頁 改成 將 while($my_row=mssql_fetch_array($result)){
for ($i=1;$i<=10;$i++){ if($my_row=mssql_fetch_array($result)){

4 分頁 加入跳頁超連結 xxx.Php >> 要跳頁的那支程式
<table border="0" cellpadding="0" cellspacing="0" > <tr> <td width="16%" align="center"><a href=xxx.php?page=1>第一頁</a></td> <td width="16%" align="center"><a href=xxx.php?page=<?=$page-1?>>上一頁</a></td> <td width="16%" align="center"><a href=xxx.php?page=<?=$page+1?>>下一頁</a></td> <td width="16%" align="center"><a href=xxx.php?page=<?=$pages?>>最後一頁</a></td> <td width="20%" align="center"></td> <td width="16%" align="center">總筆數:<font color=#ff0000><?=$num?></font> <font color=#ff0000><?=$page?></font>/<font color=#ff0000><?=$pages?></font>頁</td> </tr> </table> xxx.Php >> 要跳頁的那支程式

5 實 作 配合HTML做成表列形式 加入權限


Download ppt "分頁."

Similar presentations


Ads by Google