> 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?

OK, there is actually a reason in CF why your code isn't working as you want
it

When you put a CFLoop or a CFOutput, it carries it's field values inside
that loop - if you put another loop within it, it can't see the values of
the outer loops properly, so it tends to return the first value

I know this is strange, but it's been a problem in CF for some time, and we
work with it

Personally, I wouldn't use too many temporary variables, but use loops to
count over the query

<cfloop index="i" from=1 to="#myQuery.RecordCount#">
        <cfoutput>#myQuery.myValue[i]#</cfoutput>
        <cfloop index="j" from=1 to="#mySecondQuery.RecordCount#">
                <cfif myQuery.myValue[i] is mySecondQuery.myValue[j]>

                </cfif>
        </cfloop>
</cfloop>

Get the idea?

HTH

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to