I want to display in View specific field value from Database.
For example my table:
id | rec_scope | rec_category
--------------------------
1 | Product | New
2 | Process | Enhance
3 | Process | New
4 | System | Enhance
5 | Product | New
6 | Process | New
7 | Product | Enhance
8 | System | New
9 | Product | New
10 | Prcduct | New
I got inspiration from:
COUNT / GROUP BY with active record? and Count and display how many of specific column result
Controller:
public function index()
{
$data['records_count']= $this->dashboard_m->records_count();
$data['records_scope']= $this->dashboard_m->records_scope();
$this->template->load('template', 'dashboard', $data);
}
Model:
public function records_scope() {
$this->db->select('rec_scope, COUNT(rec_scope) as total');
$this->db->group_by('rec_scope');
$this->db->order_by('total', 'desc');
$query = $this->db->get('records');
foreach ($query->result() as $row)
$data[] = array(
'rec_scope' => $row->rec_scope,
'total' => $row->total
);
return $data;
}
How can I display in html view only the total count of specific field with specific value? Thank you.
Example:
Total count of Product is 5.
Total count Category of Product as New is 4.
Total count Category of Product as Enhance is 1.

Prcductshould beProduct, right?array('product' => array('new => '4', 'enhance' => '1'), ('process' => .... etc )?