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

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

WBOY
Release: 2016-06-13 12:21:07
Original
861 people have browsed it

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

<?php<br />// 获取select值<br />$select_value = isset($_GET['select']) ? $_GET['select'] : '';<br />//echo $select_value;<br /><br />//执行查询SQL<br />if($select_value==""){<br />	_page("SELECT o_id FROM t_order",5);<br />	$_result= mysql_query("SELECT * FROM t_order  ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}<br />if($select_value=="option1"){<br />	_page("SELECT o_id FROM t_order where status=0",4);<br />	$_result1= mysql_query("SELECT * FROM t_order where status=0 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />	//echo _num_rows($_result);<br />	<br />}<br />if($select_value=="option2"){<br />	_page("SELECT o_id FROM t_order where status=1",20);<br />	$_result= mysql_query("SELECT * FROM t_order where status=1 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}<br />if($select_value=="option3"){<br />	_page("SELECT o_id FROM t_order where status=2",20);<br />    $_result= mysql_query("SELECT * FROM t_order where status=2 ORDER BY createtime DESC LIMIT $_pagenum,$_pagesize");<br />}[code=php]<br /><form action='order.php' style="margin-left:20px;"><br /><select name="select"><br />  <option value="">全部状态</option><br />  <br />  <option value="option1" <?php<br />   // 如果在上面获取的值和这个option里的值一样,<br />   // 就打印selected,让这个option默认被选中<br />   echo $select_value == 'option1' ? 'selected' : '' <br />   ?>>未付款</option><br />   <option value="option2" <?php <br />   echo $select_value == 'option2' ? 'selected' : ''<br />   ?>>已付款待取件</option><br />  <option value="option3" <?php <br />   echo $select_value == 'option3' ? 'selected' : ''<br />   ?>>已取件待送洗</option><br /> </select> <br /> <input type="submit" value="查询" /><br /> </form><br />
Copy after login
[
------解决思路----------------------
所有 '.php?page='
都改为 '.php?select=' . $select .'&page='
------解决思路----------------------
把你搜索的字段内容也传过去

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template