public withTotalCount ( ) : MysqliDb | ||
Результат | MysqliDb |
public function withTotalCount()
{
$this->setQueryOption('SQL_CALC_FOUND_ROWS');
return $this;
}
/** * 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) { $offset = $this->pageLimit * ($page - 1); $this->db->withTotalCount(); $results = $this->get(array($this->pageLimit, $offset), $fields); $this->totalPages = round($this->db->totalCount / $this->pageLimit); return $results; }