error because of the wrapping single quotes.
And before someone else says it, cfsqlparam is a good thing.
--Ben Doom
Austin Govella wrote:
> I have a listing of classes, each with a text box next to
> them. Users will fill in a number in the text box next to
> each class and then hit submit.
>
> I'm trying to loop through the results and INSERT a
> class_id, section number, enrollment number, and date for
> each class.
>
> I use the following code to loop through checkboxes on
> another page, so I'm not sure why this gives me an error.
> ("Syntax error in INSERT INTO statement.")
>
> <!-- create lists for values --->
>
> <cfset class_id_list="#form.class_id#">
> <cfset section_no_list="#form.section_no#">
> <cfset class_enrollment_list="#form.class_enrollment#">
>
> <!--- loop through and set enrollment for each class --->
>
> <cfloop index="i" from="1" to="#ListLen(class_id_list)#">
> <cfquery name="q_approve_class"
> datasource="#application.db#">
> INSERT INTO tbl_class_enrollment (class_id,
> class_enrollment, section_no, date)
> VALUES (#ListGetAt(class_id_list, i)#,
> '#ListGetAt(class_enrollment_list, i)#',
> '#ListGetAt(section_no_list, i)#', '#enrollment_date#');
> </cfquery>
> </cfloop>
>
> This is the outputted SQL:
>
> INSERT INTO tbl_class_enrollment (class_id,
> class_enrollment, section_no, date) VALUES (841, '2',
> '03280', '4/20/2004');
>
> Any ideas?
>
> --
> Austin
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

