Do I use 'foreach' loop to do this?
Posted: Sat Sep 13, 2008 8:54 pm
I know I've seen other posts about this - thanks for your time.
I've got a data table for user comments and want to produce a report by 'category'.
example table:
category | name | date | comment
Cars| bob jones | 09-13-08 | this is my comment today
Boats | dave smith | 09-12-08 | wish I had a boat
Trucks | tom carpenter | 09-12-08 | need a big truck
I need a query that produces a report by 'category', with category heading, then items listed below it.
ex:
Cars
bob jones
Boats
dave smith
Trucks
tom carpenter
Do I need a 'FOREACH' loop to pull the categories as UNIQUE, then a WHILE loop to pull data 'WHERE category = $category'
looking 'round the web for answers, but always get the best ones here.
thanks.
I've got a data table for user comments and want to produce a report by 'category'.
example table:
category | name | date | comment
Cars| bob jones | 09-13-08 | this is my comment today
Boats | dave smith | 09-12-08 | wish I had a boat
Trucks | tom carpenter | 09-12-08 | need a big truck
I need a query that produces a report by 'category', with category heading, then items listed below it.
ex:
Cars
bob jones
Boats
dave smith
Trucks
tom carpenter
Do I need a 'FOREACH' loop to pull the categories as UNIQUE, then a WHILE loop to pull data 'WHERE category = $category'
looking 'round the web for answers, but always get the best ones here.
thanks.