Welcome Guest, Not a member yet? Register   Sign In
Selecting category details and products linked with the same category.
#2

[eluser]cideveloper[/eluser]
First thing. Please use code blocks for your code. Makes it much easier to read. like this

Controller
Code:
code here...
Model
Code:
code here...
View
Code:
code here...

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


Messages In This Thread
Selecting category details and products linked with the same category. - by El Forum - 02-04-2011, 02:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB