[eluser]cideveloper[/eluser]
First thing. Please use code blocks for your code. Makes it much easier to read. like this
Controller
Model
View
Now on to your question. From the looks of you code am I correct in saying that for each category displayed the result is all the car names from the last category.
Category 1
------------
Car_name_1_from_Category_3
Car_name_2_from_Category_3
Car_name_3_from_Category_3
Category 2
------------
Car_name_1_from_Category_3
Car_name_2_from_Category_3
Car_name_3_from_Category_3
Category 3
------------
Car_name_1_from_Category_3
Car_name_2_from_Category_3
Car_name_3_from_Category_3
If I am correct, it is because of this
Code:
foreach($fleets as $row)
{
$cid = $row->category_id;
$this->data['listefleets'] = $this->Fleets_model->list_fleets($cid);
}
from this code it looks like every time you loop you are overwriting $this->data['listefleets'] so by the time you call the view your $this->data['listefleets'] only has the info from the last loop