I have a list of groups in a SQL query and would like them to be output to an array so that it can be referenced later on.
Currently I have the following code which loops through the groups and puts them in to the $test_array:
$test_array = array();
$query = $this->site_model->list_groups();
foreach($query as $r1) :
$test_array[] = $r1->group_name;
endforeach;
This shows the following array:
Array
(
[0] => Group 1
[1] => Group 2
[2] => Group 3
[3] => Group 4
[4] => Group 5
[5] => Group 6
[6] => Group 7
[7] => Group 8
)
What I would like is for the same query to pass to an array like below, with the intention of adding other segments to the array later on:
Array
(
[Round 1] => Array
(
[0] => Group 1
[1] => Group 2
[2] => Group 3
[3] => Group 4
[4] => Group 5
[5] => Group 6
[6] => Group 7
[7] => Group 8
)
)
Is this possible?