日期:2013-08-30  浏览次数:20423 次

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);
            }
 &nb