2018年7月5日 星期四

配合bootstrap的分頁

1. 用搜尋條件處理$where


$where='1';
if ($dist && $schname)
  $where = "sch_dist='$dist' AND sch_name LIKE '%$schname%'";
elseif ($dist && !$schname)
  $where = "sch_dist='$dist'";
elseif ($schname && !$dist)
  $where= "sch_name LIKE '%$schname%'";
else
  $where='1';

2.   $count = rsCount($tn,"$where","*");

3. if ($count==0)  //無資料狀態

4.
   if (isset($_GET['page']))
     $page=intval($_GET['page']);
  else
     $page=0;

5. $list = rsList($tn," $where Limit ".($page*20).",20");

6. $i=$page*20
foreach($list as $var) {
  $i++; //序號
}

7. if ($count>20) {

沒有留言:

張貼留言