MysqliDb::withTotalCount PHP Method

withTotalCount() public method

Function to enable SQL_CALC_FOUND_ROWS in the get queries
public withTotalCount ( ) : MysqliDb
return MysqliDb
    public function withTotalCount()
    {
        $this->setQueryOption('SQL_CALC_FOUND_ROWS');
        return $this;
    }

Usage Example

コード例 #1
0
 /**
  * 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;
 }
All Usage Examples Of MysqliDb::withTotalCount