Pass mysql count to view codeigniter -
i looking count there data present only. if there record no 0 not want counted.
function count() { $this->db->select('count(id)'); $this->db->from('projects'); $this->db->where(array('id !=' => '')); $query = $this->db->get(); return $query->result_array(); }
controller $data ['total'] = $this->mymodel->count
;
view echo $total
table structure
proj_name | user id ----------------------------------- a. | 1 b. | 2 c. | 2
result should
proj_name | total
project id
a | 1 b | 2
Comments
Post a Comment