how to count number of present(status 1 means present) for each student and input beside each student profile under present column

daily_attendances database

below is under crud_model

public function take_attendance()
    {
        $students = $this->input->post('student_id');
        $data['timestamp'] = strtotime($this->input->post('date'));
        $data['class_id'] = html_escape($this->input->post('class_id'));
        $data['section_id'] = html_escape($this->input->post('section_id'));
        $data['school_id'] = $this->school_id;
        $data['session_id'] = $this->active_session;
        $check_data = $this->db->get_where('daily_attendances', array('timestamp' => $data['timestamp'], 'class_id' => $data['class_id'], 'section_id' => $data['section_id'], 'session_id' => $data['session_id'], 'school_id' => $data['school_id']));
        if($check_data->num_rows() > 0){
            foreach($students as $key => $student):
                $data['status'] = $this->input->post('status-'.$student);
                $data['student_id'] = $student;
                $attendance_id = $this->input->post('attendance_id');
                $this->db->where('id', $attendance_id[$key]);
                $this->db->update('daily_attendances', $data);
            endforeach;
        }else{
            foreach($students as $student):
                $data['status'] = $this->input->post('status-'.$student);
                $data['student_id'] = $student;
                $this->db->insert('daily_attendances', $data);
            endforeach;
        }

        $this->settings_model->last_updated_attendance_data();

        $response = array(
            'status' => true,
            'notification' => get_phrase('attendance_updated_successfully')
        );

        return json_encode($response);
    }



public function get_presentcount_by_student_id($student_id="",$status ="") {
        
        $checker = array(
        
            'student_id' => $student_id,
            'status'    => 1
        );
        $presentcount_by_student_id = $this->db->get_where('daily_attendances', $checker);
        return $presentcount_by_student_id->num_rows();
    }

under the list.php where it shows the student name and the number of days present for each student.The code is below but it does not count number of presents for each student.It still remains 0

<td>
            
                
              <?php  echo $this->crud_model->get_presentcount_by_student_id($student['user_id'],'status');?>
              <br>
              
            </td>

Student detail list shown in table format
student_detail_list