php中分页显示的问题 $_GET["page"]为空
include_once("../include/conn.php") ;
//所有订单列表
if(isset($_GET["page"])){
$page=intval($_GET["page"]) ;
}
else{
$page=1;
}
var_dump($_GET['page']) ;
$page_size=10;
$sql="select count(order_number) as num from order_table" ;
$mysql=mysql_query($sql) or die("Could not query.".mysql_error()) ;
$info=mysql_fetch_row($mysql) ;
$amount=$info["num"] ;
if($amount){
if(($amount % $page_size)==0){
$total_page=intval($amount / $page_size) ;
}
else if($amount <= $page_size){
$total_page=1 ;
}
else{
$total_page=ceil($amount / $page_size) ;
}
}
else{
$html_info="暂时没有订单。" ;
}
$string="" ;
$string .= "<a href=''?page=1> 首页 </a>" ;
$string .=" " ;
if($page<=1){
$string .= "<a href=''?page=1> 上一页 </a>" ;
}
else{
$string .= "<a href=" . $_SERVER['PHP_SELF'] . "?page=".($page - 1). "> 上一页 </a>" ;
}
if($page>=$total_page){
$string .= "<a href=" . $_SERVER['PHP_SELF'] . "?page=".$total_page."> 下一页 </a>" ;
}
else{
$string .= "<a href=" . $_SERVER['PHP_SELF'] . "?page=".($total_page + 1). "> 下一页 </a>" ;
}
$string .= "<a href=" . $_SERVER['PHP_SELF'] . "?page=".$total_page. "> 尾页 </a>" ;
$query_sql="select order_id , order_number from order_table order by order_id desc limit ($page-1) , 10" ;
$query=mysql_query($query_sql) ;
$str=
mysql_fetch_array($query) ;
$html_info="<ul>" ;
do{
$order_id=$str["order_id"] ;
$order_number=$str["order_number"] ;
$html_info.="<li><a href='com_list.php?order_id=".$order_id."'>".$order_number."</a></li>" ;
}while($str=
mysql_fetch_array($query)) ;
$html_info.="</ul>" ;
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\WWW\demo\company\com_all.php on line 72
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\WWW\demo\company\com_all.php on line 78
红色的是错误的地方,但是var_dump()函数却输出为null,求教,这个我很急的
谢谢。
------解决方案--------------------改過了,你試試
include_once("../include/conn.php") ;
//所有订单列表
$page=(isSet($_GET["page"]) And is_Numeric($_GET["page"])) ? $_GET["page"] :