Page 1 of 1

adding to a multi-dimensional array

Posted: Sat Apr 05, 2008 5:52 pm
by aceconcepts
Hi,

I want to be able to add to this array:

Code: Select all

 
$patientTreatments=array($patientId=>$treatmentSelect);
 
Currently when I add one patient and mutiple treatments to this array it outputs correctly: Array ( [2] => Array ( [0] => 4 [1] => 11 ) )

The problem is when I try to addadditional values i.e. in a loop, it does not store all values, just one.

How does one add to this collection of arrays?

Re: adding to a multi-dimensional array

Posted: Sat Apr 05, 2008 6:17 pm
by EverLearning

Code: Select all

$patientTreatments[] = array($patientId=>$treatmentSelect);

Re: adding to a multi-dimensional array

Posted: Sat Apr 05, 2008 6:18 pm
by aceconcepts
Yeh, i tried that already.

I think i will need to re-think my logic.

Thanks.