Hi again;
I have an online work schedule (stored in a MySQL database) for multiple work group members. I've got all the input, edit, delete pages (php) working nicely. Everyone can get to and edit their own calendar, everyone can select other folks to get a page showing where they are on a specific day. It all works real nice.
I'm trying to do the following:
Create a page that gets EVERYONE's records for a specific day (this part is easy... now for the hard part)
...and displays each person's schedule in separate tables, one after another: The person's name (and maybe the date) will be the label in the topmost table row, and the variable number of schedule items will appear below the label:
Example of desired output:
Joe Slick 11/17/2003
ARRIVE LEAVE LOCATION COMMENT
8:00AM 11:00AM HERE
11:30AM 12:30PM THERE LUNCH
1:00PM 4:30PM HERE
Tom Slick 11/17/2003
ARRIVE LEAVE LOCATION COMMENT
9:00AM 11:00AM HERE
11:45AM 4:30PM THERE LUNCH/NAP
etc.
Here is a simplified version of my MySQL query:
$Query = "SELECT WHEREAMI.*, DATE_FORMAT(DATE, '%a, %b %d') as ddate, TIME_FORMAT(ARRIVE, '%l:%i %p') as fARRIVE, TIME_FORMAT(LEAVE, '%l:%i %p') as fLEAVE, CONCAT(TEAM.FIRST,\" \",TEAM.LAST) AS NAME FROM WHEREAMI LEFT JOIN TEAM on (TEAM.TEAMID=WHEREAMI.TEAMID) WHERE WHEREAMI.DATE = $DATEFILTER ORDER BY NAME, DATE, ARRIVE";
The $Result of this contains all the necessary data/fields, but I believe I need some kind of nested Foreach/While loop structure...and this just confuses the heck out of me.
I believe I need something like:
//For each person:
<TABLE>
<TR><TH>$NAME</TH><TH>$ddate</TH></TR>
<TR><TH>ARRIVE</TH><TH>LEAVE</TH>TH>LOCATION</TH><TH>COMMENT</TH></TR>
//and then a while loop that repeats this row as often as needed for this specific person?
<TR><TD>$farrive</TD><TD>$fleave</TD>TD>$location</TD><TD>$comment</TD></TR><TR><>ARRIVE</TH><TH>LEAVE</TH>TH>LOCATION</TH><TH>COMMENT</TH></TR>
//end the while loop
</TABLE>
//close the table and then go to the next table for the next person until all are done.
I get the overall process, just not the specifics of the foreach and while loop codes in a situation like this.
Any help would be appreciated.
Thanks again!