电脑安全

您当前的位置:主页 > 电脑安全 >

用PHP MySQL进行分页的详细说明(二)-网络编程

来源:[db:来源]标题:   数组    编辑:电脑技术全能网 时间:2019-09-20 18:31

原标题:用PHP MySQL进行分页的详细说明(二)-网络编程
   function getDataLink(){if ( $this->numItems ){global $db;$PageID = $this->CurrentPageID;$from = ($PageID - 1)*$this->PageSize;$count = $this->PageSize;$link = $db->limitQuery($this->sql, $from, $count); //应用Pear DB::limitQuery方式保障数据库兼容性return $link;}else{return false;}}/***** 以二维数组的格局前往成果集****/function getPageData(){if ( $this->numItems ){if ( $res = $this->getDataLink() ){if ( $res->numRows() ){while ( $row = $res->fetchRow() ){$result[] = $row;}}else{$result = array();}return $result;}else{return false;}}else{return false;}}