PHP Code:
foreach ($fetch_res as $res){
echo '<pre>';print_r($res);
}
Array generated:
Array
(
[USERID] => 13663
[PROJID] => 999
[ENTRYDATE] => 13-NOV-14
[STARTDATE] => 01-NOV-14
[ENDDATE] => 20-NOV-14
[ACTIVE] => 123
[ALLOCATION] => 456
)
Array
(
[USERID] => 13664
[PROJID] => 999
[ENTRYDATE] => 13-NOV-14
[STARTDATE] => 01-NOV-14
[ENDDATE] => 20-NOV-14
[ACTIVE] => 124
[ALLOCATION] => 457
)
whereas following fields have respective ID's and status based on ID's
ALLOCATION - 456(Y) / DEALLOCAION - 457(N)
ACTIVE - 123(Y) / INACTIVE - 124(N)
Using the above information, how can I generate below required array format
array("ProjId"=>999,
"RS"=>array( //ALLOCATION ACTIVE
0=>array("13663","N","Y")
1=>array("13664","N","Y")
)
);
RS
is the resource ID
where N
and Y
indicates the status.
Thanks.