Without JS, php fully implements code for process data paging. Copy the code as follows :? Session set on the php login page. if the session contains name, session_start (); $ name $ _ SESSION [name]; if (empty ($ name) {header (Location:
The code is as follows:
// The session set on the login page. when the session contains the name
// Session_start ();
// $ Name = $ _ SESSION ['name'];
// If (empty ($ name )){
// Header ("Location: error. php ");
// Exit ();
//}
// Process-oriented, data paging
If (false! = ($ Mysql = mysql_connect ('Local mysql', 'MySQL username', 'MySQL password '))){
Mysql_query ('set names utf8', $ mysql); // sets the encoding in the database.
Mysql_select_db ("database", $ mysql );
} Else {
Die ("connection failed ");
}
$ PageSize = 10; // Number of Entries displayed on the page
$ RowCount = 0; // The total number of data records, obtained from the database
$ SqlCount = 'SELECT count (id) from employee ';
$ Res1 = mysql_query ($ sqlCount, $ mysql );
// Retrieve the number of data entries
If (false! = ($ Row = mysql_fetch_row ($ res1 ))){
$ RowCount = $ row [0];
}
// The total number of pages, calculated
$ PageCount = 0;
$ PageCount = ceil ($ rowCount/$ pageSize );
// Obtain the current page
If (! Isset ($ _ GET ['pagenow']) {// if get/post is empty, the default value is 1.
$ PageNow = 1; // Current page number
} Elseif (false! = Is_numeric ($ _ GET ['pagenow']) & $ _ GET ['pagenow'] <= $ pageCount ){
$ PageNow = $ _ GET ['pagenow'];
} Else {
Header ("Location: ../Error/error. php ");
Exit ();
}
// Print the paging data
Echo"
";
Echo"
";Echo"
Id |
Name |
Age |
Sex |
Birthday |
Edit employee |
Delete an employee |
";$ SqList = "select id, name, age, sex, birthday from employee limit". ($ pageNow-1) * $ pageSize. ",". $ pageSize;$ Res2 = mysql_query ($ sqList, $ mysql );While (false! = ($ Row = mysql_fetch_assoc ($ res2 ))){Echo"
{$ Row ['id']} |
{$ Row ['name']} |
{$ Row ['age']} |
{$ Row ['sex']} |
{$ Row ['birthday']} |
Edit |
Delete |
";}Echo"
";
// Control the number of pages displayed in the form
Echo "";
Echo"
";
?>
The http://www.bkjia.com/PHPjc/325919.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325919.htmlTechArticle code is as follows :? Php // The session set on the login page. When name exists in the session, // session_start (); // $ name = $ _ SESSION ['name']; // if (empty ($ name) {// header ("Location :...