Home Backend Development PHP Tutorial php中分页显示的有关问题 $_GET["page"]为空

php中分页显示的有关问题 $_GET["page"]为空

Jun 13, 2016 am 11:05 AM
amp mysql nbsp order page

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    $total_page=1 ;
  }
  else{
  $total_page=ceil($amount / $page_size) ;
  }
  }
  else{
  $html_info="暂时没有订单。" ;
  }
  $string="" ;
  $string .= " 首页 " ;
$string .="  " ;

if($page $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,求教,这个我很急的
谢谢。
------解决方案--------------------
改過了,你試試

1

2

3

4

5

6

<br><br>include_once("../include/conn.php") ;<br>//所有订单列表<br><br>  $page=(isSet($_GET["page"]) And is_Numeric($_GET["page"])) ? $_GET["page"] : 1;<br><br>  var_dump($page) ;<br>  $page_size=10;<div class="clear">

                  

               

               

         

            </div>

Copy after login
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

PHP's big data structure processing skills

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

How to use MySQL backup and restore in PHP?

What are the application scenarios of Java enumeration types in databases? What are the application scenarios of Java enumeration types in databases? May 05, 2024 am 09:06 AM

What are the application scenarios of Java enumeration types in databases?

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into a MySQL table using PHP?

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

How to use MySQL stored procedures in PHP?

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

How to create a MySQL table using PHP?

See all articles