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;