(Urgent !!) The query results of PHP + MYSQL are displayed on the page with the issue include_once (& quot ;. config. php & quot;); db_connect (); get the current page if (isset ($ _ POST [page]) determine whether the value of the following form post is {$ page $ _ POST [page];} elseif (isset ($ _ GET (Urgent !!) Pagination of PHP + MYSQL Query Results
Include_once ("./config. php ");
Db_connect ();
// Obtain the current page number
If (isset ($ _ POST ['Page']) // you can determine whether the values of the following form post exist.
{
$ Page = $ _ POST ['Page'];
}
Else if (isset ($ _ GET ['Page']) // you can determine whether a get value exists.
{
$ Page = intval ($ _ GET ['Page']);
}
Else
{
$ Page = 1;
}
// Number of pages per page
$ Page_size = 10;
$ Devicename = $ _ POST ["textname"];
If ($ _ POST [Submit]! = "")
{
$ SQL = "select count (*) as amount from labdeviceinfo where DeviceName = '$ devicename '";
}
Else
{
$ SQL = "select count (*) as amount from labdeviceinfo ";
}
$ Result = mysql_query ($ SQL );
$ Row = mysql_fetch_row ($ result );
$ Amount = $ row [0]; // obtain the total data volume
// Count the total number of pages
If ($ amount)
{
If ($ amount <$ page_size) // if the total data volume is less than $ PageSize, there is only one page
{
$ Page_count = 1;
}
If ($ amount % $ page_size) // Retrieve the total data volume divided by the remainder of each page
{
$ Page_count = (int) ($ amount/$ page_size) + 1; // if there is a remainder, the number of pages equals the total data volume divided by the result of each page number and then adds one
}
Else
{
$ Page_count = $ amount/$ page_size; // if there is no remainder, the number of pages equals the total data volume divided by the result of each page
}
}
Else
{
$ Page_count = 0;
}
// Flip link
$ Page_string = '';
If ($ page = 1)
{
$ Page_string. = 'homepage | previous page | ';
}
Else
{
$ Page_string. = 'homepage | previous page | ';
}
If ($ page = $ page_count) | ($ page_count = 0 ))
{
$ Page_string. = 'next page | last page ';
}
Else
{
$ Page_string. = 'next page | last page ';
}
?>
$ Server = $ _ SERVER ['php _ SELF '];$ Start = ($ page-1) * $ page_size;If ($ _ POST [Submit]! = "" | $ _ POST [textname]){$ Devicename = $ _ POST ["textname"];$ Sqlquery = "select * from labdeviceinfo where DeviceName = '$ devicename' limit $ start, $ page_size ";}Else{$ Sqlquery = "select * from labdeviceinfo limit $ start, $ page_size ";}$ Myresult = mysql_query ($ sqlquery );While ($ myrow = mysql_fetch_array ($ myresult )){?>
". $ Myrow [1].""."
". $ Myrow [2]." | "."
". $ Myrow [3]." | "."
". $ Myrow [4]." | "."
". $ Myrow [5]." | "."
". $ Myrow [6]." | "."
"." Details "." |
| "."
| ";?>