Get Number Of Rows In Codeigniter Model

[Solved] Get Number Of Rows In Codeigniter Model | Php - Code Explorer | yomemimo.com
Question : row count in codeigniter

Answered by : rich-rhinoceros-v28rvqt49doj

$this->db->where('EmpID >=', 5);
$query = $this->db->get('Employees');
echo $query->num_rows();
// Outputs, 4

Source : https://www.kodingmadesimple.com/2016/08/codeigniter-count-query-results-number-of-rows-in-table.html | Last Update : Sun, 03 Jan 21

Question : codeigniter get num_rows

Answered by : lokesh-ramchandani-in6l3jq294i2

// num rows example
$this->db->select('*');
$this->db->where('whatever');
$query = $this->db->get('table');
$num = $query->num_rows();

Source : | Last Update : Thu, 19 Nov 20

Question : codeigniter count rows

Answered by : matteo-puppis

$this->db ->where(['field'=>'foo']) ->from("tablename") ->count_all_results();
//OR
$this->db ->where(['field'=>'foo']) ->count_all_results("tablename");

Source : | Last Update : Fri, 28 Feb 20

Question : get number of rows in codeigniter model

Answered by : ankur-prajapati

function data_model() { $this->db->select('*'); $this->db->from('news_data'); $id = $this->db->get()->num_rows(); return $id;
}

Source : https://stackoverflow.com/questions/28958307/php-codeigniter-count-rows/28958771 | Last Update : Mon, 25 Oct 21

Answers related to get number of rows in codeigniter model

Code Explorer Popular Question For Php