Welcome Guest, Not a member yet? Register   Sign In
how to display count_all_results record to view
#1

Hi I am having trouble echoing a count to my view.

Please help. I am trying to count the number of subjects in the database.

Model:

PHP Code:
  public function Gettotsubjects($session_id$section_id$class_id
    {
        $this->db->select('subject_id');
        $this->db->where('session_id'$session_id);
        $this->db->where('section_id'$section_id);
        $this->db->where('class_id'$class_id);
        $this->db->distinct();
        return $this->db->count_all_results('ftscores_primary');
    

Controller:


PHP Code:
  public function Gettotsubjects($session_id$section_id$class_id)
     {
    $data $this->ftprimary_model->Gettotsubjects($session_id$section_id$class_id); 
    return $data->subject_id;
         
    


View:

PHP Code:
<?php echo $CI->Gettotsubjects($value->session_id$value->section_id$value->class_id);?>

Nothing shows in the view even though it works well when I test in the Controller
Reply


Messages In This Thread
how to display count_all_results record to view - by EseMiami - 12-15-2020, 12:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB