Stephen...
Here's some code for you. Create the table first:
CREATE TABLE links (
link_id smallint(5) unsigned NOT NULL auto_increment,
link_childof smallint(5) unsigned NOT NULL default '0',
link_name varchar(100) NOT NULL default '',
) TYPE=MyISAM;
Then here's the SQL to pull 3 levels of links.
<cfquery name="getLinks" dataSource="#Application.DSN#"
dbType="#Application.DBType#" username="#Application.username#"
password="#Application.password#">
SELECT
top.link_id AS top_id, top.link_name AS top_name,
mid.link_id AS mid_id, mid.link_name AS mid_name,
sub.link_id AS sub_id, sub.link_name AS sub_name
FROM links top
LEFT OUTER JOIN links mid
ON mid.link_childof = top.link_id
LEFT OUTER JOIN links sub
ON sub.link_childof = mid.link_id
WHERE top.link_childof = 0
GROUP BY top_name, mid_name, sub_name
ORDER BY top_name, mid_name, sub_name
</cfquery>
I use this method all the time and it works beautifully.
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: Stephen Whiteley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 6:11 AM
To: CF-Talk
Subject: Re: Recursion anyone?
Hi
Yes the problem is the recursion can't get my head round it, never used
CFSCRIPT before being a bit of a newbie.
Not trying to build a DHTML menu from scratch and would use an off the shelf
one.
CFTREE in CFMX 7 will output xml or a structure depending on format="" used.
I'll keep playing with the code provided thanks, but if anyone can expand
for a dummy, much appreciated
Steve
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222294
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54