4 Replies Latest reply on Oct 9, 2006 10:18 AM by crush78

    Creating a TOC - Need some help looping through table

    crush78
      I have a database that consists of a table with a SectionID (primary key), a ParentID, and a SectionTitle. For example, see below (sorry if my makeshift table looks funny).

      Anyways, I am looking for some suggestions and ideas on how to generate (most efficiently) a table of contents based on this information... similar to the sample TOC below my example table. What would be the best method to output the TOC with a seemingly unlimited amount of sub-sections? Right now, I currently have four seperate loops to get up to four subsections, I know it's a bad way to do it.. and that's why I am here =). So, if more subsections were required in the database... I'd like the loop to take into account each of them.. whether there are 2 subsections or 20.. whatever the case may be.

      Any help, ideas, or suggestions would be great. Code examples would be fantastic. I think I was clear enough, but it has been a very long day... so, if anyone needs clarification, don't hesitate to ask.

      Thanks a lot!
      Cody Rush