troubleshooting Question

Syntax error in INSERT INTO statement.

Avatar of RussoMA
RussoMA asked on
Web Servers
12 Comments1 Solution322 ViewsLast Modified:
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

This is the second page of a multiple stage form, the first page passes the experiment and nogroups arguments, which nogroups is an integer.

This is the coded loop section in which i am generating database entries from A to whatever character is the last group needed based on the integer passed from the first form.  This is to create groups in the database based off each experiment and have a different database entry with no primary key for each time the loop executes.

I have a feeling that there is a better way to insert a new line of data into the database other than the way I am doing in this code, which is why i am getting the syntax error that I am getting in trying to set variables to the formfields.


<strong>Experiment:</strong> <cfoutput>#form.experiment#<input type="hidden" name="experiment" value="#experiment#"></cfoutput>
Created groups named:<br><input type="text" name="nogroups"><br><br>
<cfset numgrp = (65+#form.nogroups#)>
<cfset expername = '#form.experiment#'>
<CFLOOP Index="character"
<cfoutput>#form.experiment#_#chr(character)#<cfset group = '#chr(character)#'></cfoutput><br>
<cfinsert datasource="animal" tablename="expergroup" formfields="expername,group">

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros