Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 3rd, 2005, 10:04 AM   #1
Lightninghawk
Programmer
 
Join Date: Jun 2005
Location: Douglas, Ga - USA
Posts: 32
Rep Power: 0 Lightninghawk is on a distinguished road
Send a message via MSN to Lightninghawk Send a message via Yahoo to Lightninghawk
Cold Fusion Loop problem

Ok.. so I've got this

<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="#FFFFFF"> &nbsp <cfoutput>#get_sites.site#</cfoutput></font></p></td>
	<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp New</font></p></td>
	<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp 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="#FFFFFF"> &nbsp <cfoutput>#get_session.sess#</cfoutput></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='#show_sess#'
	and b.site='#show_site#'
	group by a.majr, a.type
</cfquery>
<cfloop query="get_count">
  <tr>
	<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp <cfoutput>#majr#</cfoutput></font></p></td>
	<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp <cfoutput>#type#</cfoutput></font></p></td>
	<td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp <cfoutput>#number_students#</cfoutput></font></p></td>
  </tr>
</cfloop>
</cfloop>
</cfloop>

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

~~~
Anybody have any ideas?
__________________

+_-¤ ŦĦễ £ﺄĢĦŧňĨňĢĦǻщk ¤-_+
- PC Apps Specialist, Networking n00b, programmer in training -

Information Technology Support

Lightninghawk is offline   Reply With Quote
Old Nov 3rd, 2005, 1:05 PM   #2
Lightninghawk
Programmer
 
Join Date: Jun 2005
Location: Douglas, Ga - USA
Posts: 32
Rep Power: 0 Lightninghawk is on a distinguished road
Send a message via MSN to Lightninghawk Send a message via Yahoo to Lightninghawk
http://students.eastcentraltech.edu/...day_report.cfm this is the output page... I edited some of the color and stuff.. here is the entire code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<cfset new_count = 0>
<cfset return_count = 0>

<html>
<head>
<title>Online Instructors</title>
</head>
<body link="#00457a" vlink="#00457a" alink="#808000">
<p align="center">

<h1>Lightninghawk Computing Solutions</h1>

<p align="center"><font face="Arial" size="6" color="#00457a">Monday Report</font></p>

<p align="left">
<font face="tahoma,geneva,arial">

</font></p>

  <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"> &nbsp <cfoutput>#get_sites.site#</cfoutput></font></p></td>
    <td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp New</font></p></td>
    <td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp 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"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <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"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <cfoutput>#majr#</cfoutput></font></p></td>
    <td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp <cfoutput>#type#</cfoutput></font></p></td>
    <td bgcolor="#003194"><b>
<p align="left"><font face="Arial" size="3" color="#FFFFFF"> &nbsp <cfoutput>#number_students#</cfoutput></font></p></td>
  </tr>
</cfloop>
</cfloop>
</cfloop>

</table>
  </center>
</div>
<p align="left">&nbsp;</p>

  <p align="center">
        <font size="3"> Lightninghawk Computing Solutions </font></p>

</body>
__________________

+_-¤ ŦĦễ £ﺄĢĦŧňĨňĢĦǻщk ¤-_+
- PC Apps Specialist, Networking n00b, programmer in training -

Information Technology Support

Lightninghawk is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:07 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC