Ec (2); usage instructions on paging functions: #### retrieve paging functions #### Int $ HALT-whether or not the retrieval results are only divided into 1 page (10) display page number Int $ LRLIST-(display page number of page number-1) 2Int $ ECHOCNT-number of records displayed per page during retrieval Int $ paper-page number, pre-extracted: $ paper $ HTTP_GET_VARS [paper]; Varchar $ table-count script ec (2); script
Usage of paging functions:
#### Retrieve paging functions ####
Int $ HALT-whether the page number is displayed (1/0) when the search result is divided into only one page
Int $ LRLIST-(number of displayed page numbers-1)/2
Int $ ECHOCNT-number of records displayed per page during retrieval
Int $ paper-page number, pre-extracted: $ paper = $ HTTP_GET_VARS [paper];
Varchar $ table-data table name, with a pre-attached value: $ table = "db. table ";
Varchar $ where-search condition, with a value prefixed: $ where = "where field = 'value '";
Varchar $ enwhere-encode the original $ where twice and then submit it in GET Mode
Varchar $ splitstr-the output string of the page number. After executing the function, execute echo $ splitstr at the corresponding position;
You need to get the variable before calling the function:
$ Paper = $ HTTP_GET_VARS [paper];
$ Sumcnt = $ HTTP_GET_VARS [sumcnt];
$ Enwhere = $ HTTP_GET_VARS [enwhere];
Return (Varchar $ where)-Search Condition of the paging query statement
Note: This function calls the error handling function: nerror ($ error );
// Paging Function
Function splitlist ($ HALT, $ LRLIST, $ ECHOCNT, $ paper, $ table, $ where, $ page_id, $ userid ){
Global $ splitstr, $ sumcnt;
If ($ paper = "" | $ sumcnt = ""){
$ Query = "select count (*) as num from $ table $ where ";
$ Result = mysql tutorial _ query ($ query );
$ Row = mysql_fetch_array ($ result );
$ Sumcnt = $ row ["num"];
If ($ sumcnt = 0 ){
Nerror ("no news has been selected for this version! ");
}
$ Paper = 1;
}
$ Sumpaper = ($ sumcnt-$ sumcnt % $ ECHOCNT)/$ ECHOCNT;
If ($ sumcnt % $ ECHOCNT )! = 0) $ sumpaper + = 1;
If ($ sumpaper = 1 & $ HALT = 0) return ($ where );
$ Enwhere = base64_encode (base64_encode ($ where ));
If ($ LRLIST * 2 + 1) <$ sumpaper ){
If ($ paper-$ LRLIST) <2 ){
$ Tract = 1;
$ Sub = $ LRLIST * 2 + 1;
} Else if ($ paper + $ LRLIST) >=$ sumpaper ){
$ Tract = $ sumpaper-($ LRLIST * 2 );
$ Sub = $ sumpaper;
} Else {
$ Tract = $ paper-$ LRLIST;
$ Sub = $ paper + $ LRLIST;
}
} Else {
$ Tract = 1;
$ Sub = $ sumpaper;
}
$ Uppaper = $ paper-1;
$ Downpaper = $ paper + 1;
$ Startcnt = ($ paper-1) * $ ECHOCNT;
$ Where. = "limit $ {startcnt}, $ {ECHOCNT }";
If ($ tract> 1) {$ splitstr = "[<";}
Else $ splitstr = "[<";
For ($ I = $ tract; $ I <= $ sub; $ I ++ ){
If ($ I! = $ Paper) $ splitstr. = "". $ I ."";
Else $ splitstr. = "". $ I ."";
}
If ($ sub! = $ Sumpaper) $ splitstr. = "> ]";
Else $ splitstr. = "> ]";
Return ($ where );
}
?>