Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Coldfusion recursive categories fetching loop from Database!

Posted on 2014-04-06
2
539 Views
Last Modified: 2014-04-06
When im running this script it is printing all my categories. i want when level change <UL> if tag should enable.

i know my logic is wrong looking that's why looking you help....

Please find below my query output Screen Shoot

<cfset catLevel = 0>

<ul id="menu">

<cfset getQuery = getAllCategories()>
<cfloop query="getQuery">

<cfif #getQuery.level# GT #catLevel#>
	<ul>
    <!--Sub-Category -->
</cfif>

	<li>
    
    	<a href="http://www.link.com/">
			<cfoutput>#Name#</cfoutput>
        </a>
        
	</li>

<cfif  #getQuery.level# GT #catLevel#>
	</ul>
    <!--Sub-Category -->
</cfif>
	
    	
   			 <cfset catLevel = #getQuery.level#>

    </cfloop>
	
    
</ul>

Open in new window

queryOut.jpg
0
Comment
Question by:xeondxb
2 Comments
 
LVL 19

Accepted Solution

by:
erikTsomik earned 500 total points
ID: 39982046
take a look at this example I think that is exactly what you are looking for

http://www.dougboude.com/blog/1/2006/06/Recursive-Functions-in-ColdFusion.cfm
0
 

Author Closing Comment

by:xeondxb
ID: 39982178
yes i was looking this thanks
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question