check row count codeigniter code example
Example: codeigniter count rows
$this->db
->where(['field'=>'foo'])
->from("tablename")
->count_all_results();
//OR
$this->db
->where(['field'=>'foo'])
->count_all_results("tablename");
$this->db
->where(['field'=>'foo'])
->from("tablename")
->count_all_results();
//OR
$this->db
->where(['field'=>'foo'])
->count_all_results("tablename");