[activerecord] CodeIgniter Active Record - Get number of returned rows

This code segment for your Model

function getCount($tblName){
    $query = $this->db->get($tblName);
    $rowCount = $query->num_rows();
    return $rowCount;       
}

This is for controlr

  public function index() {
    $data['employeeCount']= $this->CMS_model->getCount("employee");
    $this->load->view("hrdept/main",$data);
}

This is for view

<div class="count">
  <?php echo $employeeCount; ?>                                                                                            
 </div>

This code is used in my project and is working properly.

result