- //每页显示条数
- $perpage = 10;
- //读取page,如果未提交则为1
- $page = empty( $_GET['page'] ) ? 1 : intval( $_GET['page'] );
- if($page<1) $page = 1;
- //开始条目
- $start = ($page-1)*$perpage;
- ckstart( $start, $perpage );
- $uid = (int)$_GET['uid'];
- if (empty($uid)) {
- $uid = $_SGLOBAL['supe_uid']; //如果地址栏没有uid参数,默认就是自己
- }
- $type = empty( $_GET['type'] ) ? 0 : intval( $_GET['type'] );
- $status = empty($_GET['status']) ? 0 : intval($_GET['status']) ;
- $where = " WHERE 1 ";
- if (!empty($type)) {
- $where .= " AND typeid = {$type} ";
- }
- if (!empty($status)) {
- $where .= " AND status = {$status} ";
- }
- $actives = array( $type => " class="active"" );
- $theurl = "ask.php?do=ask&ac={$ac}&typeid={$typeid}&status={$status}";
- $sql = "SELECT * FROM ".tname("app_ask")." $where ORDER BY id DESC limit $start,$perpage";
- $list = array( );
- $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('app_ask')." $where"), 0);
- if($count) {
- if($page > 1 && $start >=$count) {
- $page--;
- $start = ($page-1)*$perpage;
- }
- $query = $_SGLOBAL['db']->query( $sql );
- while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
- {
- $value['typename'] = $gEumsType[$value['typeid']];
- $value['content'] = getstr(strip_tags($value['content']), 150);
- $list[] = $value ;
- $count ++ ;
- }
- }
- $multi = smulti( $count, $perpage, $page, $theurl );
复制代码 顺手帮你改了一下...不知道有没有错 |