I have a list of courses that clients have signed up for. When I click on the view button, it lists all attendees for the course, shows a remove button and once they have completed a survey, it will show the survey button for perusal.
The surveys that are showing up on the right are not the surveys for this particular course. My dilemma is that each student may have taken more than one course, thus completing more than one survey. So, an earlier survey is showing instead of the current survey.
I have two tables that I have joined by a left out join, but I am still trying to wrap my head around this concept.
Signups | Course Eval |
signup_id – Primary Key rid – courseID userID courseTitle property calendardate company firstname, lastname, phone | eval_id, - primary key rid - courseID userID |
The signups table is left outer joined to the course_eval table by the query below:
The #rid#, which is the courseID is sent from the previous page.
<cfquery name="getsignups" datasource="#application.dsn#">
select signups.courseTitle,signups.property,signups.calendardate,signups.com pany,signups.firstname,signups.lastname,signups.email,signups.phone,si gnups.userID,signups.signup_id,signups.rid,course_eval.userID,course_e val.eval_id
from signups
left outer join course_eval ON signups.userID = course_eval.userID
where signups.rid = #rid#
</cfquery>
My Output:
<cfoutput>
<cfloop query="getsignups">
<TR>
<td>#rid# - #firstname# #lastname#|<a href="mailto:#email#">#email#</a></td>
<td>Ph: #phone#</td>
<td width="24"><a href="showsignups.cfm?signup_id=#signup_id#&go=go" class="button">Remove</a></td>
<cfif eval_iD GT ""><td width="24"><a href="../../forms/surveys.cfm?userID=#userID#" class="button">Survey</a></td><cfelse><td width="24"> </td></cfif>
</tr>
</cfloop>
</cfoutput>
How do I get the appropriate course to show ?