[eluser]leonglass[/eluser]
I can almost do what I need now and currently my query code looks like this.
Code:
function index()
{
$data['cats'] = $this->db->get('GA_cats');
foreach($data['cats']->result() as $row)
{
$data[$row->name] = $this->db->get('GA_games', 4);
}
$this->load->view('game_view', $data);
}
I have checked and I have result sets for each of the categories if I manually use the category name in the view
I can extract the data. How can I get the data out using a nested foreach and using the name field as the var name which relates to the query I need to use.
Code:
foreach($cats->result() as $row)
{
foreach($row->name->result() as $game)
{
print $game->id . " " . $game->name;
}
}
Obviously the $row->name->result part is causing me problems. So how can I get the $row->name part to be used as the variable name that points to my query results?