当前位置:Gxlcms > mysql > 我的一个php_mysql分页类_MySQL

我的一个php_mysql分页类_MySQL

时间:2021-07-01 10:21:17 帮助过:18人阅读

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 {
&

人气教程排行