My database has the following setup

productid | productname | category id

and I want to output them like so:

category #1
item 1 
item 2
item 3

category #2
item 1 
item 2
item 3

I used group by the group them together and that works fine, but I want to loop through each group and display the contents of that group. How would I do this?

Edit
Report