$_GET 变量中,如果要传递两个或以上变量,需要用&连接
如:myself.php?post_id=3&offset=4
$page_query
=
"
select * from new_article where re_flag=0 order by new_datetime desc
"
;
$each_page
=
10
;
//
每页显示15条
/*
************ 分页功能参数 **************
*/
$page_result
=
$db
->
query(
$page_query
);
$page_total_rows
=
$page_result
->
num_rows;
$page_total
=
intval
(
$page_total_rows
/
$each_page
);
//
总页数
if
(
$page_total
<
(
$page_total_rows
/
$each_page
))
{
$page_total
++
;
}

if
(
$offset
==
NULL
)
{
$offset
=
0
;
//
起始值
}

if
(
$offset
>=
1
)
//
假如在第一页,则 "上一页" 不显示
{
$prev_offset
=
$offset
-
$each_page
;
//
上一页偏移量
// echo '<a href="'.$PHP_SELF.'?offset='.$prev_offset.'">上一页</a>';
}

$current_page
=
$offset
/
$each_page
+
1
;
//
echo ' 第'.$current_page.'页 ';
if
(
!
((
$offset
/
$each_page
)
==
$page_total
-
1
)
&&
$page_total
!=
1
)
//
若为最后一页 则 "下一页" 不显示
{
$next_page
=
$offset
+
$each_page
;
//
echo '<a href="'.$PHP_SELF.'?offset='.$next_page.'">下一页</a>';
}

/*
++++++++++++++++++++++++++++++++++++++++
*/
以下为显示“上一页”,“下一页”内容
if
(
$offset
>=
1
)
{
echo
'
<a href="
'
.
$PHP_SELF
.
'
?offset=
'
.
$prev_offset
.
'
">上一页</a>
'
;
}
echo
'
第
'
.
$current_page
.
'
页 (共
'
.
$page_total
.
'
页)
'
;
if
(
!
((
$offset
/
$each_page
)
==
$page_total
-
1
)
&&
$page_total
!=
1
)
{
echo
'
<a href="
'
.
$PHP_SELF
.
'
?offset=
'
.
$next_page
.
'
">下一页</a>
'
;
}
else
{
echo
'
'
;
}
如:myself.php?post_id=3&offset=4


































以下为显示“上一页”,“下一页”内容













