Php entry mysql PageQuery class. Include ("dbClass. inc ");
Class PageQuery extends dbClass {
Var $ Offset; // record Offset
Var $ Total; // The Total number of records.
Var $ maxLine; // number of records displayed per page
Var $ result; // read the result
Var $ TPages; // The total number of pages.
Var $ CPages; // Current page number
Var $ PageQuery; // display the parameters to be passed by page
Var $ Query; // query statement
Var $ QueryPart; // query part after "FROM"
Var $ QueryString ;//? Later
Var $ FilePath;
// Number of lines displayed per page
Function PageQuery ($ pageLine = 10 ){
$ This-> dbClass ();
$ This-> maxLine = $ pageLine;
}
// Total number of records
Function getTotal (){
Return $ this-> Total;
}
// Display the total number of pages
Function getTotalPages (){
Return $ this-> TPages;
}
// Display the current page number
Function getCurrenPages (){
Return $ this-> CPages;
}
Function myQuery ($ SQL, $ flag = 1 ){
GLOBAL $ offset;
$ This-> Query = $ SQL;
// Get the file name
// $ This-> FilePath = $ GLOBALS ["REQUEST_URI"];
$ This-> FilePath = $ GLOBALS ["SCRIPT_NAME"];
// Obtain query conditions
$ This-> QueryString = $ GLOBALS ["QUERY_STRING"];
// Echo $ this-> QueryString ."
";
// Intercept query statements after "from"
& Nbs
MySQL tutorial is: php getting started mysql PageQuery class. P; $ this-> QueryPart = trim (strstr ($ SQL, "from "));
// Calculate the offset
If (! Isset ($ offset) $ this-> Offset = 0;
Else $ this-> Offset = (int) $ offset;