I have a table with several fields that need to be displayed per record (there are thousands), the table has a "category" column with "data1" data2" "bob3" "imis4" and a dozen other things, is there a way (sql statement) that would grab each of the GROUP BY and display the CATAGORY name befor eit listed off the people in the catagory... i.e
catagory BOY
- Jim
- Farnk
- Sam
- Wally
category Grl
- Sue
- Beth
category DOG
- Ruger
- Fido
and so on and so forth?
Grouping Table Results Dynamicly
Moderator: General Moderators
ORDER BY category, name ( - or whatever col Jim, Beth & Fido are in)
As you loop through the result with mysql_fetch_array or whatever, store the current category in a $var.
In each new loop, check $result['category'] against $var: if they are different, echo $result['category'] . '<br />'; and reset $var = $result['category'].
If they are the same, do nothing.
Initialise $var = ''; before the while loop.
As you loop through the result with mysql_fetch_array or whatever, store the current category in a $var.
In each new loop, check $result['category'] against $var: if they are different, echo $result['category'] . '<br />'; and reset $var = $result['category'].
If they are the same, do nothing.
Initialise $var = ''; before the while loop.