Getting started with php mysql PageQuery class _ MySQL-mysql tutorial

Source: Internet
Author: User
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.