Also, I meant to say, with the link here:
http://cookbooks.adobe.com/post_Create_nested_lists_from_a_recordset__PHP_-16720.html
I meant to ask, is that two solutions depending on situation, or one?
ie is the part up until 'Creating nested lists' for one scenario, and the bit below for another scenario?
That probably sounds dumb, but my brain is a bit fried from looking at so many different variations on this over the last couple of days!