If I understand what you're saying, I had something similar to this a little
while ago. Don't pull all your hair out ;-) The only way I found to work
around my loop within a loop problem was to set a variable in the outer loop
= to the value I needed to use in the inner loop. Then use this new variable
in the inner loop. The other thing is to see if you can actually JOIN your
tables in the original query.
HTH
Stephen
-----Original Message-----
From: Terry Bader [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 10:26 AM
To: CF-Talk
Subject: Unusual Results, help
Ok, i'm having some problems with the below code.... here's the problem...
in the loop <CFLOOP QUERY="qry_missioncomm"> it is always seeing
qry_missions.mission_id being 1....
if you notice the test code i put in just before it, i see that
qry_missions.mission_id is and check to make sure the previous query has
records... then i set a test variable to qry_missions.mission_id
as such:
<CFOUTPUT>#qry_missions.mission_id#,#qry_missioncomm.recordcount#</CFOUTPUT>
-before<BR>
<CFSET test = qry_missions.mission_id>
so in the 2nd iteration of this loop, i get:
2,9-before
with test being set to 2
now comes the loop:
<CFLOOP QUERY="qry_missioncomm">
followed by:
<CFOUTPUT>#test# should equal #qry_missions.mission_id#</CFOUTPUT>-test<BR>
and wtf??? i get:
2 should equal 1-test
?????????? why isnt the qry_missions.mission_id equal to 2 inside the
second loop??? there are no other declarations here and after the loop,
qry_missions.mission_id is equal to 2....
CODE HERE:
----------------------------------------------------------------------------
-----------------------------------------------------------
<CFQUERY NAME="qry_missions" DATASOURCE="#request.mainDSN#">
SELECT *
FROM tbl_mission
WHERE mission_id <> 0
</CFQUERY>
<CFLOOP QUERY="qry_missions">
<CFQUERY NAME="qry_missioncomm" DATASOURCE="#request.mainDSN#">
SELECT *
FROM tbl_node
WHERE node_id IN
(
SELECT node_id
FROM tbl_mission_comm
WHERE mission_id = #qry_missions.mission_id#
)
</CFQUERY>
<CFOUTPUT>#qry_missions.mission_id#,#qry_missioncomm.recordcount#</CFOUTPUT>
-before<BR>
<CFSET test = qry_missions.mission_id>
<CFLOOP QUERY="qry_missioncomm">
<CFOUTPUT>#test# should equal
#qry_missions.mission_id#</CFOUTPUT>-test<BR>
<CFQUERY NAME="qry_missionq" DATASOURCE="#request.mainDSN#">
SELECT *
FROM tbl_question
WHERE q_node = #qry_missioncomm.node_id#
AND q_mission = #qry_missions.mission_id#
AND q_deleted = 0
</CFQUERY>
<CFOUTPUT>#qry_missioncomm.node_id#-node
#qry_missions.mission_id#-mission</CFOUTPUT><BR>
</CFLOOP>
</CFLOOP>
Terry Bader
IT/Web Specialist
Macromedia Certified Coldfusion Developer
EDO Corp - Combat Systems
(757) 424-1004 ext 361 - Work
[EMAIL PROTECTED]
(757)581-5981 - Mobile
[EMAIL PROTECTED]
icq: 5202487 aim: lv2bounce
http://www.cs.odu.edu/~bader
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists