MysqliDb::paginate PHP Method

paginate() public method

Pagination wraper to get()
public paginate ( string $table, integer $page, array | string $fields = null ) : array
$table string The name of the database table to work with
$page integer Page number
$fields array | string Array or coma separated list of fields to fetch
return array
    public function paginate($table, $page, $fields = null)
    {
        $offset = $this->pageLimit * ($page - 1);
        $res = $this->withTotalCount()->get($table, array($offset, $this->pageLimit), $fields);
        $this->totalPages = ceil($this->totalCount / $this->pageLimit);
        return $res;
    }

Usage Example

コード例 #1
0
ファイル: dbObject.php プロジェクト: Basheir/AFix
 /**
  * Pagination wraper to get()
  *
  * @access public
  * @param int $page Page number
  * @param array|string $fields Array or coma separated list of fields to fetch
  * @return array
  */
 private function paginate($page, $fields = null)
 {
     $this->db->pageLimit = self::$pageLimit;
     $res = $this->db->paginate($this->dbTable, $page, $fields);
     self::$totalPages = $this->db->totalPages;
     return $res;
 }
All Usage Examples Of MysqliDb::paginate