I'm having a weird problem doing a nested loop and a nested query. I
have two queries. The topmenu query returns ids 1,2,3 and 4. The
leftmenu query returns ids 5,6,7,8,9 for topmenu.id=1 and 14,15,16 for
topmenu.id=3. The queries are right and return the right data. For
some reason when I'm trying to output it, it messes up the topmenu.id
and thinks that it's 1 when it's supposed to be 3. Below is the code
and the output. Am I doing something wrong?
<cfquery name="topmenu" datasource="batu2">
select id
from categories
order by orderid
</cfquery>
<cfloop query="topmenu">
<cfoutput>#topmenu.id#::<br></cfoutput>
<cfquery name="leftmenu" datasource="batu2">
select id
from menu
where parent=#topmenu.id#
</cfquery>
<cfloop query="leftmenu">
<cfoutput>#topmenu.id#:#leftmenu.id#<br></cfoutput>
</cfloop>
</cfloop>
1::
1:5
1:6
1:7
1:8
1:9
2::
3::
1:14
1:15
1:16
4::
Russ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists