I have sent $data[‘items’] to my view which has created an array full of objects which I can echo with a foreach loop.
foreach($items as $row)
{
echo $row->NAME . " - " . $row->COLOUR . "<br>";
}
what I want to do is echo them to the browser in groups with the name of the colour as a header tag then start the loop for that colour. I’m just not sure what type of loop to do or should I have a loop within a loop?
BLUE
-item 1
-item 3
RED
-item 2
-item 4
-item 5
1 Answer