Questions about pagination in php $ _ GET ["page"] is blank

Source: Internet
Author: User
The problem of pagination in php $ _ GET [& quot; page & quot;] is empty include_once (".. /include/conn. php ") & nbsp; // list of all orders & nbsp; if (isset ($ _ GET [" page "]) {& nbsp; & n questions about pagination in php $ _ GET ["page"] is blank
Include_once ("../include/conn. php ");
// List of all orders
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 ("cocould 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 = "There are no orders currently. ";
}
$ String = "";
$ String. = "homepage ";
$ String. = "";

If ($ page <= 1 ){
$ String. = "previous page ";
}
Else {
$ String. = "previous page ";
}

If ($ page >=$ total_page ){
$ String. = "next page ";
}
Else {
$ String. = "next page ";
}

$ String. = "Last page ";

$ 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
The red color is incorrect, but the var_dump () function output is null. please advise. I am in a hurry.
Thank you.
------ Solution --------------------
Changed.


Include_once ("../include/conn. php ");
// List of all orders

$ Page = (isSet ($ _ GET ["page"]) And is_Numeric ($ _ GET ["page"])? $ _ GET ["page"]: 1;

Var_dump ($ page );
$ Page_size = 10;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.