Maybe I should start this as another thread, but since we've got the ball rolling here....
With your help I've got the basics of looping through and getting values from a two-dimensional array, but I've still got one little pesky problem:
Say I've got a bunch of students, they have been tested at various time of the year. Sometimes a kid may have been absent for a test and missed it, so there's no test score data.
I get my data for all phases with a query something like:
"SELECT ID, TESTPHASE, SCORE FROM DATATABLE"
The results all get nicely packed into a multidimensional array called $SCORES.
Later on, I want to unpack this array into variables that I can use in a jpgraph (I dearly love jpgraph!).
This nested set of FOREACH loops gets me pretty close to where I want:
FOREACH ($SCORES AS $TESTPHASE => $KIDSCORES) {
ECHO "$TESTPHASE : $KIDSCORES<BR>";
FOREACH ($KIDSCORES AS $ID => $SCORE) {
ECHO $SCORES[$TESTPHASE][$ID]."<BR>";
}
}
But, for those cases where I have a student who missed the test during a particular phase, I need to insert a NULL for the "cell" where the data would be missing. I've figured out how to do this for multi-record insert queries, but have not quite figured it out for this situation.
I suppose I need to insert some sort of if/else operation in my nested loops? Is the "isset" command involved?
Thanks...