[eluser]Unknown[/eluser]
Let's say that I have one table with categories like management and secretaries and another table with employees data. each employee belongs to a category.
When I want to show it like this:
management
tony m
rami p
and so on, I need to run one loop for the categories and a nested loop for the employees data (as shown in the attached image)
If I create such loops in the model I don't know how to show it correctly in the view
(basically because I can return only one array variable from the model)
like:
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}