<cffunction name="generate_list" output="true" >
       <cfargument name="parentID" required="true"/>

       <cfset var list_items = "" />

       <cfquery name="list_items" dbtype="query">
       SELECT          catID,category,parent_id
       FROM            categories
       WHERE           parent_id = <cfqueryparam value="#parentid#"
null="#(parentID eq "")/>
       </cfquery>

       <cfif list_items.recordcount gt 0>
       <cfloop query="list_items">
               <cfif list_items.currentrow eq 1><ul></cfif>
               <cfoutput><li>#category#</cfoutput>
               <cfset generate_list(sID)/></li>
- Hide quoted text -
               <cfif list_items.currentrow eq
list_items.recordcount></ul></cfif>
       </cfloop>

       </cfif>

</cffunction>

<cfset generate_list(0)/>


On 9/28/06, Doug Brown <[EMAIL PROTECTED]> wrote:
> See, there I go again not making my self clear. The table actually has more
> than just makes and models of cars.
> It has antiques, autos, furniture, blah blah. each parent category has it's
> child category and each child has it's own child. As an example, Antiques
> would have a child of asian antiques and it would have a child of all the
> different asian antiques you could think of. I hope this makes more sense.
> Anyhow the first group of childs I can refer back to their parent, but the
> second group of childs are referenced back to the child of the parent and
> not the parent directly.
>
>
>
>
> Doug
>
>
>
> ----- Original Message -----
> From: "Jim Wright" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[email protected]>
> Sent: Thursday, September 28, 2006 9:43 AM
> Subject: Re: Arghhhh!!
>
>
> > Doug Brown wrote:
> > > Hey Jim...I have one more quick question for you.
> > >
> > > As I stated before I have just the one table to display the makes and
> models
> > > for the menu, and I am kinda dumbfounded as to how to display all the
> makes
> > > on one page with their corresponding models beneath them. Can this be
> > > accomplished with one table?
> > >
> > > IE:
> > >
> > > cat_id
> > > category
> > > parent_id
> > >
> > > Right now the data looks like so
> > >
> > > cat_id        category        parent_id
> > > 1                chevy                null
> > > 2                 ford                 null
> > > 3                Camaro                1
> > > 4                Escort                    2
> >
> > Something like...
> >
> > SELECT a.category AS make, b.category AS model
> > FROM categories a LEFT JOIN categories b ON a.cat_id = b.parent_id
> > WHERE a.parent_id IS NULL
> > ORDER BY a.category,b.category
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254640
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to