Sounds like you're trying to implement a tree (it's formal 
name). For a good lesson, check out Steve Nelson's free 
tutorial at www.secretagents.com. The concepts somewhat 
complicated, so you might have to read it a few times, but 
works well.

As an alternative, you could just keep track of the 
following for each record:

1. ID
2. Name
3. Parent ID

Where Parent ID is the parent of the current record. This 
makes it hard to build a link from a record (known as a 
node) back to the root of the tree. You'd probably have to 
loop over a CFQUERY, which gets nasty.

Hope this helps

Norman

Quoting Michael Lugassy <[EMAIL PROTECTED]>:

> We have a big index of sites, each site belongs to a
> certain "main category"
> and a sub_category. 
> 
> Certain sites are nested inside 2,3 and even 5
> sub-sub categories.
> 
> How can I create a category(ies) table(s) that will
> store the catID and catNAME?
> (each category/subcategory ID takes 2 places xx)
> 
> Here is an Example:
> 
> The Yahoo! site, for example is in:
> 
> Computers and Internet > Internet > Internet and
> Search Engines > Directories > World
> 
> Where Computers and Internet = 24 00 00 00 00
> (I've added space just to explain what I need)
> Internet = 24 11 00 00 00
> Internet and Search Engines = 24 11 92 00 00 00
> Directories = 24 11 92 83 00 00
> World = 24 11 92 83 00 
> 
> Ofcourse there could be more then one sub-sub
> category named "world"
> and the sub-sub count varies.
> 
> Any help, tips, something?
> 
> Michael.
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to