Codeigniter: Array returns only one row in view
21:02 30 Apr 2017

I am creating an exam report in php using codeigniter and postgresql which displays the questions and the number of students who correctly answered the questions and the number of students who answered the questions incorrectly. When I tried displaying the data, it only prints one row when in fact I have 3 rows. I used print_r() to know what are the elements of my array and it looks like this: RESULT: print_r()

But then when I tried displaying it in views, it turns out like this: Result of displaying in View

I have these in my controller:

public function loadViewExamResult(){
    $this->load->model('exam_model');
    $exam_no= $this->uri->segment(3);
    $data['answers'] = $this->exam_model->correctWrong($exam_no);
    print_r($data['answers']) ;

    $this->load->view('exam_report_chart',$data);

}

Model:

 question;
      $correct = $row->correct;
      $wrong = $row->wrong;
    }
 ?>


 
EXAM STATISTICS
td>
QUESTION No. of Correct No. of Wrong

How do I solve this?

php arrays codeigniter model-view-controller html-table