OccasionalCoder
Technical User
Hi:
Here's the code I'm using:
--------
<cfquery name="get_agency" datasource="#db#" username="#un#" password="#pw#">
select * from agency where agency_id = #url.agency_id#
</cfquery>
<cfoutput query="get_agency">
<h1>#agency_id# #agency_name#</h1>
<cfset thisagency = #get_agency.agency_id#>
</cfoutput>
<cfloop query="get_agency">
<cfquery name="get_division" datasource="#db#" username="#un#" password="#pw#">
select * from division where agency_id = #thisagency#
</cfquery>
<cfoutput query="get_division"><h2>#division_id# #division_name#</h2></cfoutput>
<cfset thisdivision=#get_division.division_id#>
<cfloop query="get_division">
<cfquery name="get_unit" datasource="#db#" username="#un#" password="#pw#">
select * from unit where division_id = #thisdivision#
</cfquery>
<cfoutput query="get_unit"><h3>#unit_id# #unit_name#</h3></cfoutput>
</cfloop>
</cfloop>
-----
Here's the results I'm getting:
------
2 Air Force Research Laboratory/Human Effectiveness Directorate (comes from agency table)
1 Biosciences & Protection Division (comes from division table)
2 Directed Energy Bioeffects Division (comes from division table)
3 Warfighter Interface Division (comes from division table)
4 Warfighter Training Research Division (comes from division table>
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
3 Human Effectiveness and Logistics (comes from unit table)
-------
Here's the results I want:
----
2 Air Force Research Laboratory/Human Effectiveness Directorate
1 Biosciences & Protection Division
1 Biomechanics Division (HEPA)
2 Applied Biotechnology (HEPB)
2 Directed Engery Bioeffects Division
3 Warfighter Interface Division
4 Warfighter Training Research Division
3 Human Effectiveness and Logistics
(I added indents to help clarify levels)
What am I doing wrong?
Thanks
Here's the code I'm using:
--------
<cfquery name="get_agency" datasource="#db#" username="#un#" password="#pw#">
select * from agency where agency_id = #url.agency_id#
</cfquery>
<cfoutput query="get_agency">
<h1>#agency_id# #agency_name#</h1>
<cfset thisagency = #get_agency.agency_id#>
</cfoutput>
<cfloop query="get_agency">
<cfquery name="get_division" datasource="#db#" username="#un#" password="#pw#">
select * from division where agency_id = #thisagency#
</cfquery>
<cfoutput query="get_division"><h2>#division_id# #division_name#</h2></cfoutput>
<cfset thisdivision=#get_division.division_id#>
<cfloop query="get_division">
<cfquery name="get_unit" datasource="#db#" username="#un#" password="#pw#">
select * from unit where division_id = #thisdivision#
</cfquery>
<cfoutput query="get_unit"><h3>#unit_id# #unit_name#</h3></cfoutput>
</cfloop>
</cfloop>
-----
Here's the results I'm getting:
------
2 Air Force Research Laboratory/Human Effectiveness Directorate (comes from agency table)
1 Biosciences & Protection Division (comes from division table)
2 Directed Energy Bioeffects Division (comes from division table)
3 Warfighter Interface Division (comes from division table)
4 Warfighter Training Research Division (comes from division table>
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
1 Biomechanics Division (HEPA) (comes from unit table)
2 Applied Biotechnology (HEPB) (comes from unit table)
3 Human Effectiveness and Logistics (comes from unit table)
-------
Here's the results I want:
----
2 Air Force Research Laboratory/Human Effectiveness Directorate
1 Biosciences & Protection Division
1 Biomechanics Division (HEPA)
2 Applied Biotechnology (HEPB)
2 Directed Engery Bioeffects Division
3 Warfighter Interface Division
4 Warfighter Training Research Division
3 Human Effectiveness and Logistics
(I added indents to help clarify levels)
What am I doing wrong?
Thanks