Hello i have a problem with the logic to have a multidimentional array for each while loops that i had. I do not know why is it not working.
i wanted to have like this as concept
data >
ser_id > 14
org_name > "org a"
ser_id > 15
org_name > "org b"
but the output is like this
Array
(
[data] => Array
(
[ser_id0] => 14
[0] => Array
(
[0] => Gannon University
)
[ser_id1] => 15
[1] => Array
(
[0] => Lions Club
)
[ser_id2] => 16
[2] => Array
(
[0] => Rotatory Club
)
)
)
Can you help me with the logic. Here is the code i worked on with rows loop fetched from db.
$rs = $this->crud->fetchResultSet("services");
$rows = array();
$i=0;
while($row = $rs->fetch_assoc()){
//$rows = arra
$ser_id = $row["ser_id"];
$rows["data"][$i] = $ser_id;
$orgrs = $this->crud->fetchSingleResultSet("organizations","ser_id",$row['ser_id']);
$j=0;
while($innrow = $orgrs->fetch_assoc()){
$rows["data"][$i][$j] = $innrow["org_name"];
$j++;
}
$i++;
}