The output that I'm looking for is:
---Site
------Session
---------Class ........... students in class
---------Class ........... students in class
------Session
---------Class ........... students in class
---Site
ect ect....
~~~~~~~~~~~
The current outcome :
---Site
---------Class ........... students in class
or sometimes
---Site
------Session
---Site...
~~~~~~~~~~~~
It's almost like it has a mind of it's own.
The Query code is:
<div align="center">
<cfquery name="get_sites" datasource="books">
select distinct site
from enr_report
order by site
</cfquery>
<table border="0" width="81%" bgcolor="#000000" cellspacing="1" cellpadding="0" col="4">
<cfloop query="get_sites">
<tr>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="red">   <cfoutput>#get_sites.site#</cfoutput></font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF">   New</font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF">   Returning</font></p></td>
</tr>
<cfquery name="get_session" datasource="books">
select distinct sess
from enr_report
where site='#get_sites.site#'
order by sess
</cfquery>
<cfloop query="get_session">
<tr>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="yellow">        <cfoutput>#get_session.sess#</cfoutput></font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"></font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"></font></p></td>
</tr>
<cfquery name="get_count" datasource="books">
select count(a.id) as number_students, a.type, a.majr
from enr_report a, enr_report b
where a.id = b.id
and b.sess='#get_session.sess#'
and b.site='#get_sites.site#'
group by a.type, a.majr
</cfquery>
<cfloop query="get_count">
<tr>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="green">             <cfoutput>#majr#</cfoutput></font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF">   <cfoutput>#type#</cfoutput></font></p></td>
<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF">   <cfoutput>#number_students#</cfoutput></font></p></td>
</tr>
</cfloop>
</cfloop>
</cfloop>
To view the results please view this page:
http://students.eastcentraltech.edu/dcarroll/monday_report.cfm
My instructor was having problems with it. So he asked me to search around and try to find the answer.
Any help here will be appreciated.
I know the format of the page is strange, but we did that so we could get it seperated a little bit until we could get it fixed.
Thanks in advance. :)