>백엔드 개발 >PHP 튜토리얼 >php查询结果的分页显示,点击下一页时不能记寓所查询的东西,只要点击下页时, 显示出来的 结果却是全部数据

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

WBOY
WBOY원래의
2016-06-13 12:21:071305검색

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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.