欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

我的一个php_mysql分页类_MySQL

程序员文章站 2022-05-10 13:56:28
...
class RSPage {
var $Debug = 0;
var $sqoe = 1; // sqoe= show query on error
var $Link_ID = 0;
var $Record = array();
var $Row;
var $numRow;
var $Parse;
var $Error = "";
var $m_timeFmt = "YYYY-MM-DD HH24:MI:SS";

var $m_num=-1;
var $m_sql;
var $m_pageSize=10;
var $m_cmt;
var $m_curPage=1;
function open($DB_Link)
{
$this->Link_ID = $DB_Link;
}

function query($Query_String,$page=1,$cnt=-1,$size=10) {
if($Query_String=="")
{
echo "执行语句不能为空!";
return false;
}
if(!$page)
$page = 1;
if(!$cnt)
$cnt = -1;
$this->m_pageSize = $size;

if($this->Parse){
mysql_free_result($this->Parse);
}

if($cnt!=-1){
$this->m_num = $cnt;
}
else{
$result = mysql_query($Query_String, $this->Link_ID);
if(!$result){
$this->Error=mysql_error($this->Link_ID);
}
else{
$this->m_num = mysql_num_rows($result);
}
/*
$cntsql = "select count(*) max_num from ($Query_String)";
$maxnum = 0;
$result = mysql_query($sqlstr,$this->Link_ID);
$ret = mysql_fetch_array($result);
mysql_free_result($result);
if(!$ret) {
$this->Error=mysql_error($this->Link_ID);
}
else {
&

相关标签: Error