mysql_data_seek(
$result
,
$skipCount
);
}
$pageSize
=
$this
->
$list_rows
;
while
(
$row
= mysql_fetch_array(
$result
))
{
$pageSize
--;
$lastResult
[] =
$row
;
if
(
$pageSize
== 0)
{
break
;
}
}
return
$lastResult
;
}
public
function
get_skip_row_count()
{
return
$this
->list_rows*(
$this
->now_page-1);
}
/**
* 构造函数
* @param unknown_type $data
*/
public
function
__construct(
$data
=
array
())
{
$this
->total_rows =
$data
['total_rows'];
$this
->parameter = !
empty
(
$data
['parameter']) ?
$data
['parameter'] : '';
$this
->list_rows = !
empty
(
$data
['list_rows']) &&
$data
['list_rows'] <= 100 ?
$data
['list_rows'] :
15;
$this
->total_pages =
ceil
(
$this
->total_rows /
$this
->list_rows);
$this
->page_name = !
empty
(
$data
['page_name']) ?
$data
['page_name'] : 'p';
$this
->ajax_func_name = !
empty
(
$data
['ajax_func_name']) ?
$data
['ajax_func_name'] : '';
$this
->method = !
empty
(
$data
['method']) ?
$data
['method'] : '';
/* 当前页面 */
if
(!
empty
(
$data
['now_page']))
{
$this
->now_page =
intval
(
$data
['now_page']);
}
else
{
$this
->now_page = !
empty
(
$_GET
[
$this
->page_name]) ?
intval
(
$_GET
[
$this
->page_name]):1;
}
$this
->now_page =
$this
->now_page <= 0 ? 1 :
$this
->now_page;
if
(!
empty
(
$this
->total_pages) &&
$this
->now_page >
$this
->total_pages)
{
$this
->now_page =
$this
->total_pages;
}