PHP implements the paging class of the database
Recently in the implementation of a product management project, the product data can be paged output.
Therefore, the implementation of a paging class operation, the code is as follows:
Class seppage{var$rs;var$pagesize;var$nowpage;var$array;var$conn;var$sqlarr; function ShowData ($sqlarr,$conn,$pagesize,$nowpage){//Definition methodif(!Isset$nowpage)||$nowpage=="")//Determine if the variable value is empty$this -Nowpage=1;Else$this -Nowpage=$nowpage;$this -PageSize=$pagesize;//define the number of records per page output$this -Conn=$conn;//The identity returned by the linked database$this -Sqlstr=$strsql;//Execute Query statement$this -Rs=$this -Conn -Pageexecute ($this -SQLSTR,$this -PageSize$this -Nowpage); @this -Array=$this -Rs -GetRows ();//Get Record Countif(Count ($this -Array)==0||$this -Rs==false)returnfalse;Elsereturn$this -Array; } function ShowPage ($contentname,$utits,$anothersearchstr,$anothersearchstrs,$class){$allrs=$this -Conn -Execute ($this -SQLSTR);//Execute Query statement$record=Count$allrs -GetRows ());//Total Statistics Records$pagecount=Ceil ($record/$this -pagesize);//Calculate a total of several pages$str.=$contentname." ".$record."& nbsp;".$utits." "Per page ". $this->pagesize." ". $utits."  The ". $this->rs->absolutepage ()." page/Shared ". $pagecount." page"; $str. = "    "; if (! $this->rs->atfirstpage ()) $str. = "<a href=". $_server[' Php_self ')."?Page=1&Parameter1=". $anothersearchstr."&Parameter2=". Anothersearchsstrs."Class=". $class.">Home</A>"; else $str. = "<Font Color=' #555555 '>Home</font>"; $str. = " "; if (! $this->rs->atlastpage ()) $str. = "<a href=". $_server[' Php_self ')."?Page=($this -Rs -AbsolutePage ()+1)."& parameter1=".$anothersearchstr."& parameter2=".Anothersearchsstrs."class=".$class."> Next page";Else$str.="Next Page";$str.=" ";if(!$this -Rs -Atlastpage ())$str.=". $_server [' php_self '] ."? Page= ". $pagecount." & Parameter1= ". $anothersearchstr." & Parameter2= ". Anothersearchsstrs." Class= ". $class." > Last "; else $str. = "Last"; if (count ($this->array) ==0 | | $this->rs==false) return ""; else return $str; }}
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP implementation of the database paging class, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.