PHP class for Oracle Database Record Display on pages

Source: Internet
Author: User
<? Php /************************************** * ****** TOracleViewPagev2.0 date: -9-23 display the Oracle database record category update date on pages:-10-19 added the TopRecord display function, promised the number of records displayed on the first page and other pages

<? Php

/*************************************** ******
TOracleViewPage v2.0
Date: 2000-9-23

Categories of Oracle Database records displayed on pages


Updated on: 2000-10-19
The TopRecord display function is added, and the number of records displayed on the first page is different from that on other pages.

Author: sharetop
Email: ycshowtop@21cn.com

**************************************** *******/
Class TOracleViewPage {

Var $ Table; // Table name
Var $ MaxLine; // number of lines per page

Var $ LinkId; // Database Connection number
Var $ Id; // sorting reference field

Var $ Offset; // record Offset
Var $ Total; // The Total number of records.
Var $ Number; // Number of records read on the current page
Var $ TopNumber; // number of records actually retrieved when reading a new record
Var $ Result; // read the Result
Var $ TopResult; // the result of reading a new record

Var $ TheFirstPage; // specify the link to the first page.
Var $ StartRec; // specify the start record number on the second page

Var $ TPages; // The total number of pages.
Var $ CPages; // Current page number

Var $ TGroup;
Var $ PGroup; // Number of page numbers displayed on each page
Var $ CGroup;

Var $ Condition; // display conditions such as: where id = '$ ID' order by id desc
Var $ PageQuery; // display the parameters to be passed by page

//-------------------------------------
// The following structure functions, destructor, and initialization functions
//-------------------------------------

// Structure function
// Parameter: table name, maximum number of rows, reference fields by page, number of page numbers displayed on each page

Function TOracleViewPage ($ TB, $ ML, $ id ){
Global $ offset;

$ This-> Table = $ TB;
$ This-> MaxLine = $ ML;
$ This-> Id = $ id;

$ This-> StartRec = 0;
If (isset ($ offset) $ this-> Offset = $ offset;
Else $ this-> Offset = 0;

$ This-> Condition = '';
$ This-> TheFirstPage = NULL;
$ This-> PageQury = NULL;
}

// Initialization
// Parameter: user name, password, database
Function InitDB ($ user, $ password, $ db ){
If (PHP_ OS = 'winnt ') $ dllid = dl ('php3 _ oci80.dll ');
$ This-> LinkId = OCILogon ($ user, $ password, $ db );
}

// Disconnect
Function Destroy (){
OCILogoff ($ this-> LinkId );
}

//-------------------------
// Set function
//-------------------------

// Set display conditions
// For example, where id = '$ ID' order by id desc
// The request is a string that complies with the SQL syntax (this string will be added after the SQL statement)

Function SetCondition ($ s ){
$ This-> Condition = $ s;
}

// Set the display quantity for each group
Function SetNumGroup ($ pg ){
$ This-> PGroup = $ pg;
}
// Set the homepage. if not, the homepage is NULL.
Function SetFirstPage ($ fn ){
$ This-> TheFirstPage = $ fn;
}
// Set the start record. If no record exists, the default value is 0.
Function SetStartRecord ($ org ){
$ This-> StartRec = $ org;
}

// Set transfer parameters
// Key parameter name value
// For example, setpagequery ('id', $ id). if multiple parameters are to be passed, you can call this function multiple times.

Function SetPageQuery ($ key, $ value ){
$ Tmp [key] = $ key; $ tmp [value] = $ value;
$ This-> PageQuery [] = $ tmp;
}

//--------------------------------

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.