1

I have table like this

enter image description here

enter image description here

These are the codes:

Controller :

https://pastebin.com/7vf9zRrY

View :

https://pastebin.com/1tLCjHsH

Why did I get error when I try to run those codes? This is the message error:

enter image description here

What may I do to fix that? Thank you

r34627673
  • 293
  • 3
  • 18

1 Answers1

0

The variable $faculty is not an array of objects, but strings (is what the method column() of the Query class returns). Therefore, the foreach gives you the value of the variable right away:

foreach($faculty as $key=>$data){
                array_push($faculty_lessarr,
                    array('name'=>$data,
...
gmc
  • 3,910
  • 2
  • 31
  • 44