Question
cfloop question
Hi All,
I have written a small application for students to select a school project from a list of projects.
I have two tables:
PROJECT_DESCRIPT This has the code number for each of the projects and their descriptions and the teacher running them.
PROJECT_RESULTS This has the results of the students selections. The name of the student and the code number of the project taken from the PROJECT_DESCRIPT table.
This has been fine unil this year I have been asked to show project description and teacher in my results printout instead of just the code.
I thought that I could do it like this:
<cfquery name="output" datasource="biol_course">
select * from PROJECT_RESULTS
</cfquery>
<cfloop query = "output">
<cfoutput>
<cfquery name="output2" datasource="biol_course"">
select * from PROJECT_DESCRIPT where code = #code#
</cfquery>
#name#, <cfoutput query="output2">#project#, #teacher#</cfoutput></cfoutput><br />
</cfloop>
This clearly doesn't work so I am obviously looking at this wrongly and being quite dumb!. Any advice on pointing me in the right direction would be gratefully received. I don't do enough coldfusion work to develop my skills and as a solo worker I don't have anyone else to share ideas.
Thanks,
Paul.
I have written a small application for students to select a school project from a list of projects.
I have two tables:
PROJECT_DESCRIPT This has the code number for each of the projects and their descriptions and the teacher running them.
PROJECT_RESULTS This has the results of the students selections. The name of the student and the code number of the project taken from the PROJECT_DESCRIPT table.
This has been fine unil this year I have been asked to show project description and teacher in my results printout instead of just the code.
I thought that I could do it like this:
<cfquery name="output" datasource="biol_course">
select * from PROJECT_RESULTS
</cfquery>
<cfloop query = "output">
<cfoutput>
<cfquery name="output2" datasource="biol_course"">
select * from PROJECT_DESCRIPT where code = #code#
</cfquery>
#name#, <cfoutput query="output2">#project#, #teacher#</cfoutput></cfoutput><br />
</cfloop>
This clearly doesn't work so I am obviously looking at this wrongly and being quite dumb!. Any advice on pointing me in the right direction would be gratefully received. I don't do enough coldfusion work to develop my skills and as a solo worker I don't have anyone else to share ideas.
Thanks,
Paul.
