I am looking for a solution to display number of rows based on a particular column data using CodeIgniter.
This is basically for a Shop registration project. I have a database table named shopowner with a column named status. and this status column have only 3 values. ie. if status is 0 then the record is waiting for approval, once approved the status will become 1 and 2 for rejection. Now in my Dashboard I need to display total number of pending, Approved and Rejected records. Can any one help me out with this and please tell me what to add in Model, Controller and view. I am totally new to CodeIgniter. Thanks in advance.
Model
public function count_rows($status)
{
$this->db->select('status, COUNT(status) as total');
$this->db->group_by('status', $status);
$this->db->get('shopowner');
}
Expected output would be like
Total Registration : 4 Pending Approval : 2 Approved : 1 Rejected : 1