1

This is my array:

$recid[$row['Rec_Mgmt_id']] = array
(
    'program'=> $row['Program'],
    'doc' => $row['Date_of_clinic'],
    'name' => $row["FName"]. " " . $row['LName'],
    'claim' => $row['ClaimNum'],
    'md' => $row['Doctor'],
    'prognosis' => $row['Prognosis'],
    'workStatus' => $row['WorkStatus'],
    'service' => array
    (
        $row['Service_Requested_id'] => array
        (
            'name' => $row['Service'], 
            'site' => $row['Service_Site'], 
            'status' => $row['Approval_Status'], 
            'denial' => $row['Reason_Denial'], 
            'approvalDate' => $row['Date_Approval'], 
            'txIn' => $row['TX_Intake_Date'], 
            'txOut' => $row['TX_Discharge_Date'], 
            'comments' => $row['Comments']
        )
    )
);

How would I add the below array as another 'service' array?

array($row['Service_Requested_id'] => array
    (
    'name' => $row['Service'], 
    'site' => $row['Service_Site'], 
    'status' => $row['Approval_Status'], 
    'denial' => $row['Reason_Denial'], 
    'approvalDate' => $row['Date_Approval'], 
    'txIn' => $row['TX_Intake_Date'], 
    'txOut' => $row['TX_Discharge_Date'], 
    'comments' => $row['Comments']
    )
);

Maybe it is because I'm feeling a little brain dead..but I have tried numerous approaches and I am not able to get this added.

1 Answer 1

1

I am not sure i fully understand your question but I think this will do what you need.

$recid[$row['Rec_Mgmt_id']]['service'][$row['Service_Requested_id']] = array (      
     'name' => $row['Service'], 
     'site' => $row['Service_Site'], 
     'status' => $row['Approval_Status'], 
     'denial' => $row['Reason_Denial'], 
     'approvalDate' => $row['Date_Approval'], 
     'txIn' => $row['TX_Intake_Date'], 
     'txOut' => $row['TX_Discharge_Date'], 
     'comments' => $row['Comments']); 
Sign up to request clarification or add additional context in comments.

3 Comments

This might make you end up with an array of an array. I would remove the array($row['Service_Requested_id'] => and its closing array bracket.
You wouldn't want to append the new array, but instead set the new array under the specific key.$recid...['service'][$row['Service_Requested_id']] = array('name'=>...); Or use array_merge to add the new array.
Wow...I am really brain dead...I did exactly that..but instead added the array (service_request_id) into the service...$recid[$row['Rec_Mgmt_id']]['service']=array($row['Service_Requested_id'] => array(.....))...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.