You just made my month. Let me know what beer you like... =]

Cheers & thanks,

Kevin

-----Original Message-----
From: Sean Corfield [mailto:[EMAIL PROTECTED]
Sent: Monday, March 07, 2005 4:08 PM
To: CF-Talk
Subject: Re: Recursive Function


On Mon, 7 Mar 2005 15:53:17 -0600, Kevin Aebig <[EMAIL PROTECTED]> wrote:
> This makes no sense to me as to why it's failing... If anyone can shed
some
> light... I'll owe them a beer.

You aren't declaring your local variables so they are being
overwritten by your recursive calls...

> <cffunction name="makeTree" hint="Creates HTML Tree from Query object">
>         <cfargument name="dataObj" required="true">
>         <cfargument name="parentID" required="true">

Add this:
    <cfset var getCurrentItems = 0 />
    <cfset var checkForChild = 0 />

>         <cfquery name="GetCurrentItems" dbtype="query">
>         SELECT * FROM dataObj
>         WHERE parentid = #parentID#
>         ORDER BY submitted
>         </cfquery>
>
>         <ul>
>         <cfloop query="GetCurrentItems">
>
<cfoutput><li>#GetCurrentItems.comment#(#GetCurrentItems.id#)</cfoutput>
>
>                 <cfquery name="CheckForChild" dbtype="query">
>                         SELECT * FROM dataObj WHERE parentid =
#GetCurrentItems.id#
>                 </cfquery>
>
>                 <cfif CheckForChild.RecordCount GT 0 >
>                         <cfset makeTree(dataObj, GetCurrentItems.id)>
>                 </cfif>
>         </cfloop>
>         </ul>
> </cffunction>
--
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme
Got Gmail? -- I have 50, yes 50, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197764
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to