Home > Database > Mysql Tutorial > php入门mysql分页PageQuery类_MySQL

php入门mysql分页PageQuery类_MySQL

WBOY
Release: 2016-06-01 13:55:26
Original
1083 people have browsed it

include("dbClass.inc");
class PageQuery extends dbClass {
    var $Offset;             // 记录偏移量
    var $Total;             // 记录总数
     
    var $maxLine;             // 记录每页显示记录数
    var $result;             // 读出的结果
   
    var $TPages;             // 总页数
    var $CPages;             // 当前页数
   
    var $PageQuery;         // 分页显示要传递的参数
    var $Query;             // query 语句
    var $QueryPart;         // " FROM " 以后的 query 部分
    var $QueryString;         // ? 以后部分 
     
    var $FilePath;
           
    // 每页显示行数
    function PageQuery($pageLine=10) {   
        $this->dbClass();
        $this->maxLine = $pageLine;
      }
     
      // 记录总数
    function getTotal(){
        return $this->Total;
    }
     
      // 显示总页数
    function getTotalPages() {
        return $this->TPages;
    }

    //显示当前所在页数
    function getCurrenPages() {         
        return $this->CPages;
    }
   
    function myQuery($sql, $flag=1){
            GLOBAL $offset;
            $this->Query = $sql;
       
        // 获取文件名
        //$this->FilePath = $GLOBALS["REQUEST_URI"];
            $this->FilePath = $GLOBALS["SCRIPT_NAME"];
           
            // 获取查询条件
            $this->QueryString = $GLOBALS["QUERY_STRING"];           
            //echo $this->QueryString . "
";           
           
            // 截取 " from " 以后的 query 语句
   &nbs

MySQL教程是:php入门mysql分页PageQuery类。p;        $this->QueryPart = trim(strstr($sql, " from "));
           
            // 计算偏移量
            if (!isset($offset)) $this->Offset = 0;
            else $this->Offset = (int)$offset;                            

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template