Modified based on the teacher’s gradeList
public function imgList()
{
$Image = img_tb::all();
$count = img_tb::count ( ); $value->name,
] = $data;
}
$this->view->assign('imgList',$ImgList);
$this->view->assign('count',$ count);
//Render image list template
return $this -> fetch('img_list');
}
Define $i=0 before foreach;
$ImgList[$i] = $data;
$i++;
That’s it
Then try declaring this variable before and assign it to empty.