A class that connects odbc to mssql paging_PHP tutorial
Jul 21, 2016 pm 04:08 PM
class Pages{
var $cn; //Connect the database cursor
var $d; //Connect the data table Cursor
var $result; //Result
var $dsn; > var $total; //Total number of records
var $pages; //Total number of pages
var $onepage; //Number of entries per page
var $page; //Previous page
var $net; //Next page
var $i; ??> $this->cn=@odbc_connect($dsn,$user,$pass);
if(!$this->cn){
$error="Error connecting to database";
??????????????????????????????????????????????????????????????????????????????????????????????????@odbc_do($this->cn,$sql);
If(!$this->d){
$error="A small error occurred during query...";
????????? $this->getMess($error); $this ->sql=$sql;
??????????????? $dT=$this->getDo($this->sql);????????????????????????????????????????????????????????????'total');//Why can't $this->d be used here?
return $this->total;
}
function getList($sql,$onepage,$page){
$this->s=$sql;
$this->onepage=$onepage;
$this->page=$page;
$this->dList=$this->getDo($this->s); // Cursor for joining table
$this->pages=ceil($this->total/$this->onepage);
if($this->pages==0) ??
$ this->pages++; //Cannot get page 0
if(!isset($this->page))
$this->page=1;
$this-> fre = $this->page-1; //The number of pages to be displayed
->page-1)*$this->onepage;
//if($this->nums!=0){
this->i<$pg->getNums();odbc_fetch_row($this->dd),$this->i++);//Same as above
???????????????????????????????????????????????????????????????>i=0;//Why can’t this part be encapsulated?
????????return $this->dList;
????}
????function getFanye(){
????????$str="";
????????if($this->page!=1)
????????????$str.=" 首頁(yè) fre."> 前頁(yè) ";
????????????else
????????????????$str.="首頁(yè) 前頁(yè)";
????????if($this->page<$this->pages)
????????????$str.="nxt."> 后頁(yè) ";
????????????else
????????????????$str.=" 后頁(yè) ";
????????if($this->page!=$this->pages)
????????????$str.="pages."> 尾頁(yè) ";
????????????else
????????????????$str.=" 尾頁(yè) ";
????????$str.="共".$this->pages."頁(yè)";
????????$str.="您正瀏覽第".$this->page."頁(yè)";
????????return $str;
????}
????function getNums(){
????????return $this->nums;
????}
????function getOnepage(){//每頁(yè)實(shí)際條數(shù)
????????return $this->onepage;
????}
????function getI(){
????????return $this->i;
????}
????function getPage(){
????????return $this->page;
????}
????function getMess($error){//定制消息
????????echo"
????????exit;
????}
}
$pg=new Pages();
$pg->getConnect("lei","sa","star");
$pg->getTotal("select count(*) as total from xs");????????????//連學(xué)生表求總數(shù)
$pg->getList("select xs_name from xs order by xs_id",8,$page);
if($pg->getNums()!=0){
????for($i=0;$i<$pg->getNums();odbc_fetch_row($pg->dList),$i++);//同上
}
$i=0;
while(odbc_fetch_row($pg->dList)){
????$name=odbc_result($pg->dList,"xs_name");
????echo $name."
";
????if($i==$pg->getOnepage()){//跳出循環(huán)
????????break;
????}
????$i++;
}
echo$pg->getFanye();
?>

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

1. The Origin of .NETCore When talking about .NETCore, we must not mention its predecessor .NET. Java was in the limelight at that time, and Microsoft also favored Java. The Java virtual machine on the Windows platform was developed by Microsoft based on JVM standards. It is said to be the best performance Java virtual machine at that time. However, Microsoft has its own little abacus, trying to bundle Java with the Windows platform and add some Windows-specific features. Sun's dissatisfaction with this led to a breakdown of the relationship between the two parties, and Microsoft then launched .NET. .NET has borrowed many features of Java since its inception and gradually surpassed Java in language features and form development. Java in version 1.6

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

How to build applications using .NET? Building applications using .NET can be achieved through the following steps: 1) Understand the basics of .NET, including C# language and cross-platform development support; 2) Learn core concepts such as components and working principles of the .NET ecosystem; 3) Master basic and advanced usage, from simple console applications to complex WebAPIs and database operations; 4) Be familiar with common errors and debugging techniques, such as configuration and database connection issues; 5) Application performance optimization and best practices, such as asynchronous programming and caching.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

How to deploy a C# .NET app to Azure or AWS? The answer is to use AzureAppService and AWSElasticBeanstalk. 1. On Azure, automate deployment using AzureAppService and AzurePipelines. 2. On AWS, use Amazon ElasticBeanstalk and AWSLambda to implement deployment and serverless compute.

Redis is a memory data structure storage system, mainly used as a database, cache and message broker. Its core features include single-threaded model, I/O multiplexing, persistence mechanism, replication and clustering functions. Redis is commonly used in practical applications for caching, session storage, and message queues. It can significantly improve its performance by selecting the right data structure, using pipelines and transactions, and monitoring and tuning.

Redis is superior to traditional databases in high concurrency and low latency scenarios, but is not suitable for complex queries and transaction processing. 1.Redis uses memory storage, fast read and write speed, suitable for high concurrency and low latency requirements. 2. Traditional databases are based on disk, support complex queries and transaction processing, and have strong data consistency and persistence. 3. Redis is suitable as a supplement or substitute for traditional databases, but it needs to be selected according to specific business needs.

C# is widely used in enterprise-level applications, game development, mobile applications and web development. 1) In enterprise-level applications, C# is often used for ASP.NETCore to develop WebAPI. 2) In game development, C# is combined with the Unity engine to realize role control and other functions. 3) C# supports polymorphism and asynchronous programming to improve code flexibility and application performance.
