当前位置:Gxlcms > PHP教程 > php查询结果的分页显示,点击下一页时不能记寓所查询的东西,只要点击下页时,显示出来的结果却是全部数据

php查询结果的分页显示,点击下一页时不能记寓所查询的东西,只要点击下页时,显示出来的结果却是全部数据

时间:2021-07-01 10:21:17 帮助过:24人阅读

php查询结果的分页显示,点击下一页时不能记住所查询的东西,只要点击下页时, 显示出来的 结果却是全部数据 。
// 获取select值
$select_value = isset($_GET['select']) ? $_GET['select'] : '';
//echo $select_value;

//执行查询SQL
if($select_value==""){
_page("SELECT o_id FROM t_order",5);
$_result= mysql_query("SELECT * FROM t_order ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");
}
if($select_value=="option1"){
_page("SELECT o_id FROM t_order where status=0",4);
$_result1= mysql_query("SELECT * FROM t_order where status=0 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");
//echo _num_rows($_result);

}
if($select_value=="option2"){
_page("SELECT o_id FROM t_order where status=1",20);
$_result= mysql_query("SELECT * FROM t_order where status=1 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");
}
if($select_value=="option3"){
_page("SELECT o_id FROM t_order where status=2",20);
$_result= mysql_query("SELECT * FROM t_order where status=2 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");
}[code=php]

[
------解决思路----------------------
所有 '.php?page='
都改为 '.php?select=' . $select .'&page='
------解决思路----------------------
把你搜索的字段内容也传过去

人气教程排行