I'm trying to fetch a data from a table and should count its no. of students value.
Output as follows:
No. of Students per course
BSCS 3
BSIS 1
CT 2
Table course_code: BSCS = 3, BSIS = 1, CT = 2
I'm using multiple where clauses and it isn't working. Could someone help me on this please. Thanks!
Controller
public function enrollment_summary()
{
$data['title'] = 'Enrollment Summary';
$this->load->model('report_model');
$data['bscs'] = $this->report_model->get_studentsPerCourse();
$data['bsis'] = $this->report_model->get_studentsPerCourse();
$data['ct'] = $this->report_model->get_studentsPerCourse();
$this->load->view('report_enrollment_summary', $data);
}
Model
public function get_studentsPerCourse()
{
$bscs = $this->input->post('students');
$bsis = $this->input->post('students');
$ct = $this->input->post('students');
$this->db->select('*');
$this->db->from('students');
$this->db->where('course_code', 'BSCS', $bscs);
$this->db->where('course_code', 'BSIS', $bsis);
$this->db->where('course_code', 'ct', $ct);
return $this->db->count_all_results();
}