Home >Backend Development >PHP Tutorial >Class to display Oracle database records in pages_PHP tutorial
<?php
/*********************************************
TOracleViewPagev 2.0
Date: 2000-9-23
Class for displaying Oracle database records in paging
Update date: 2000-10-19
Add the function of displaying TopRecord, allowing the number of records displayed on the first page to be the same as Other pages are different.
Author: sharetop
email:ycshowtop@21cn.com
****************************** *******************/
class TOracleViewPage {
var $Table; //Table name
var $MaxLine; //Number of rows displayed per page
var $ LinkId; //Database connection number
var $Id; //Sort reference field
var $Offset; //Record offset
var $Total; //Total number of records
var $Number; //Number of records read on this page
var $TopNumber;//Number of records actually retrieved when reading new records
var $Result; //Results read
var $TopResult;//Read Result of new record
var $TheFirstPage; //Specially specify the link of the first page
var $StartRec; //Specify the starting record number of the second page
var $TPages; //Total pages Number
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 parameters to be passed in pages
//------------ --------------------------
//The following constructors, destructors and initialization functions
//----- --------------------------------
//Constructor
//Parameters: table name, maximum Number of rows, paging reference fields, 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
//Parameters: username, 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