public count_all_results ( $table = '' ) : string | ||
리턴 | string |
function count_all_results($table = '')
{
if ($table != '') {
$this->_track_aliases($table);
$this->from($table);
}
$sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows'));
$query = $this->query($sql);
$this->_reset_select();
if ($query->num_rows() == 0) {
return '0';
}
$row = $query->row();
return $row->numrows;
}
/** * Return the number of results for the current query * */ public function count() { //If data has already been selected return the row count if (sizeof($this->all()) > 0) { return sizeof($this->all()); } else { $this->db->from($this->_table()); return $this->db->count_all_results(); } }