// num rows example
$this->db->select('*');
$this->db->where('whatever');
$query = $this->db->get('table');
$num = $query->num_rows();
function data_model() {
$this->db->select('*');
$this->db->from('news_data');
$id = $this->db->get()->num_rows();
return $id;
}