| Magnus Thyvold 2006-03-21, 9:58 pm |
| I have a SELECT query that joins a few tables. The resulting query result
has data that is repeated in several columns where a one to many join has
occured. I want to be able to loop the output so that info that is the same
from row to row is not repeated.
Example of returned rows:
Program Name | Timeslot | Host
Program 1 | Tuesday 8pm | Jane Doe
Program 1 | Tuesday 8pm | Jack Flash
Program 2 | Wednesday 12noon | Tom Sawyer
Program 3 | Wednesday 2pm | Huck Finn
Program 3 | Wednesday 2pm | Becky Sharp
Program 4 Thursday 11am | Anne Shirley
etc.
I don't want to repeat the full row of data whern a program has more than
one host. info about Program 1 to be output once and then loop over the
hosts like this:
Program 1
Tuesday 8pm
Jane Doe
Jack Flash
Program 2
Wednesday 12noon
Tom Sawyer
Program 3
Wednesday 2pm
Huck Finn
Becky Sharp
Program 4
Thursday 11
Anne Shirley
I've looked on the net and in my PHP books for some examples or best
pratices but have not seen anything helpful. I am still fairly new to PHP
but have worked with other languages where this was easy. I am not ready to
delved into PEAR just yet. I'd appreaciate some help or being pointed to
some resources on the net.
I have made some efforts to get this working but when looping it some rows
were being skipped in the display.
Thanks for your help.
--
Magnus Thyvold
http://www.cjsf.ca
|