php中分頁顯示的有關問題 $_GET["page"]為空白

來源:互聯網
上載者:User
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 .= " 首頁 " ;
$string .=" " ;

if($page<=1){
$string .= " 上一頁 " ;
}
else{
$string .= " 上一頁 " ;
}

if($page>=$total_page){
$string .= " 下一頁 " ;
}
else{
$string .= " 下一頁 " ;
}

$string .= " 尾頁 " ;

$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="
    " ;
    do{
    $order_id=$str["order_id"] ;
    $order_number=$str["order_number"] ;
    $html_info.="
  • ".$order_number."
  • " ;
    }while($str=mysql_fetch_array($query)) ;
    $html_info.="
" ;


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"] : 1;

var_dump($page) ;
$page_size=10;
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.