The issue is that, I am only getting the last data from the above function. In my database, I have four categories listed in my database but only receiving the data from the last query. How can I get rid of this? I have tried multiple variations over here.
I have also tried normal sql queries with the same, but I got the data from last id only.
foreach($category as $cat){
$cat_id = $cat->id;
$data['catalog'] = $this->homemodel->getCatalog($cat_id);
}
2
Answers
Try like this
Replace Your Code with below code