It can be said that this is the most complete page flip function you have ever seen. the detailed content is explained in the code! SyntaxHighlighter. all (); info & nbsp; | & nbsp; Security & nbsp; | & nbsp
It can be said that this is the most complete page flip function you have ever seen. the detailed content is explained in the code!
// Set the number of entries in the list
$ ListNum = 25;
// Set the start position
If ($ Start_Num = ""){
$ Start_Num = 0;
}
// Set the front flip
$ Begin_Num = $ Start_Num-$ ListNum;
// Set the suffix
$ End_Num = $ Start_Num + $ ListNum;
// Variable used to calculate the number of items during page turning
$ N = 0;
// The initial value of the generated list
$ ArtList = "";
// Connect to the database (ODBC is used in this example )!
$ Conn = ODBC_CONNECT ("DSN", "user", "password ");
$ SQL = "SELECT field FROM table ";
// Well, here all the select statements are available, which is inefficient and exaggerated. However, this is just to demonstrate our central content-turning pages!
$ Result = $ ODBC_DO ($ Conn, $ SQL );
While ($ odbc_fetch_row ($ Result )){
If ($ n <$ Start_Num + $ ListNum & $ n> = $ Start_Num ){
$ Thevalue = ODBC_RESULT ($ Result, "field ");
$ ArtList. = $ n. $ thevalue ."
";
}
$ N ++;
}
// Obtain the start item of the last page
If ($ n % $ ListNum = 0 ){
$ LastPage = $ n-$ ListNum;
} Else {
$ LastPage = $ n-$ n % $ ListNum;
}
// Always have the last page
$ ArtList. ="
| <最前一页 ";
// Only when Start_Num is greater than 0 can the previous page be available If ($ Start_Num> 0 ){ $ ArtList. = "< <上一页 "; } Else { $ ArtList. = "< <上一页 "; } // If Start_Num is already within the range of the last page, there cannot be a Next page If ($ Start_Num <$ n-$ ListNum ){ $ ArtList. = "next page> "; } Else { $ ArtList. = "next page> "; } // There is always the last page $ ArtList. = "Last Page> | "; Echo $ artList; ?>