I am trying to finalize an online registration process. The form consists of checkboxes and text fields. Email is being used as the PK and a value of aap2@nyu.edu was entered into the form. The values are passed to an action form which contains the following queries:
But I keep getting the following error when I try to join the #Form.h_email# (PK) with the other tables to preview registration details.
Here is the error message:
[Macromedia][SQLServer JDBC Driver][SQLServer]The column prefix 'aap2@nyu' does not match with a table name or alias name used in the query.
The error occurred in \onlinereg_action.cfm: line 71
69 : FROM tblCourse a, tblAttendee b, tblRegistration_details d
70 : WHERE a.course_id = d.course_id
71 : AND #Form.h_email# = b.h_email
72 : </cfquery>
73 :
SQL SELECT b.firstname, b.lastname, a.course_date, a.course_name FROM tblCourse a, tblAttendee b, tblRegistration_details d WHERE a.course_id = d.course_id AND aap2@nyu.edu = b.h_email
Code:
<!--- Initialize a variable called Continue to control the transaction --->
<CFSET Continue = "Yes">
<!--- begin transaction --->
<CFTRANSACTION ACTION="BEGIN">
<!--- Insert the new record --->
<cftry>
<cfquery name="addAttendees" datasource="seligins">
INSERT INTO tblAttendee
(h_email, firstname, l......, etc.)
VALUES
('#Form.h_email#', '#Form.firstname#', '#Form.lastname#', ....., etc.)
</cfquery>
<CFCATCH TYPE="Database">
<CFTRANSACTION ACTION="ROLLBACK"/>
<CFSET ProblemQuery = "addAttendees">
<CFSET Continue = "No">
</CFCATCH>
</cftry>
<!--- Insert registration & payment status--->
<CFIF Continue EQ "Yes">
<CFTRY>
<CFTRANSACTION ACTION="COMMIT"/>
<cfquery name="addRegs" datasource="seligins">
INSERT INTO tblAttendee_registration
(h_email, payment_status)
VALUES
('#Form.h_email#', 'paid')
</cfquery>
<CFCATCH TYPE="Database">
<CFTRANSACTION ACTION="ROLLBACK"/>
<CFSET ProblemQuery = "addRegs">
<CFSET Continue = "No">
</cfcatch>
</cftry>
</cfif>
<!--- if the record was successfully added, commit the transaction --->
<CFIF Continue EQ "Yes">
<CFTRANSACTION ACTION="COMMIT"/>
</CFIF>
</CFTRANSACTION>
<CFIF Continue EQ "Yes">
<!--- Insert course details --->
<cfset thisList = "#Form.course_id#">
<cfloop list = "#thisList#" index="nthisList">
<cfquery name="insertCourse" datasource="seligins">
INSERT INTO tblRegistration_details
(h_email, course_id)
VALUES
('#Form.h_email#', '#nthisList#')
</cfquery>
</cfloop>
</cfif>
<CFIF Continue EQ "Yes">
<cfquery name="getReg" datasource="seligins">
SELECT b.firstname, b.lastname, a.course_date, a.course_name
FROM tblCourse a, tblAttendee b, tblRegistration_details d
WHERE a.course_id = d.course_id
AND #Form.h_email# = b.h_email
</cfquery>
<html>
<head>
<link rel="stylesheet" type="text/css" href="seligtest.css">
<title>Registration Submitted!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p></p>
<p></p>
<table width="250" cellspacing="0" cellpadding="0">
<cfoutput query="getReg">
<h3>
#firstname# #lastname#, here are your registration details:<br>
</h3>
<tr>
<th scope="col">#course_date#</th>
<th scope="col">#course_name#</th>
</tr>
</table>
</cfoutput>
<CFELSE>
<CFOUTPUT>
<H2>An Error has occurred. All queries have been rolled back</H2>
<B>The query that caused the error is: <I>#ProblemQuery#</I>.</B>
</CFOUTPUT>
</CFIF>
But I keep getting the following error when I try to join the #Form.h_email# (PK) with the other tables to preview registration details.
Here is the error message:
[Macromedia][SQLServer JDBC Driver][SQLServer]The column prefix 'aap2@nyu' does not match with a table name or alias name used in the query.
The error occurred in \onlinereg_action.cfm: line 71
69 : FROM tblCourse a, tblAttendee b, tblRegistration_details d
70 : WHERE a.course_id = d.course_id
71 : AND #Form.h_email# = b.h_email
72 : </cfquery>
73 :
SQL SELECT b.firstname, b.lastname, a.course_date, a.course_name FROM tblCourse a, tblAttendee b, tblRegistration_details d WHERE a.course_id = d.course_id AND aap2@nyu.edu = b.h_email