Skip to main content
Known Participant
Dec 16, 2012 7:01 PM UTC
Question

UPDATE a database errror

I am trying to run an update query and I am getting an error on the last cfqueryparam.  The error is "There is an error in the syntax of the query. Does anyone see the problem with this query.

CODE:

<!---Insert record into table OAREI_results--->

      <cfquery datasource="xxx" name="addResult">

                  INSERT INTO OAREI_results {poll_ID, question_ID, answer_text, votes)

            VALUES (<cfqueryparam value="#FORM.QuestionID#" cfsqltype="cf_sql_varchar" />,

                                <cfqueryparam value="#FORM.QuestionID#" cfsqltype="cf_sql_varchar" />,

                                <cfqueryparam value="#FORM.Other#" cfsqltype="cf_sql_varchar" />,

                    <cfqueryparam value="1" cfsqltype="cf_sql_integer" />)

        </cfquery>

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

BKBK
Community Expert
Community Expert
Dec 23, 2012 9:37 AM UTC

Dan has obviously answered your question. Please kindly mark it as answered.

Translate
Known Participant
Dec 23, 2012 3:18 PM UTC

That was not the solution.  Although I had that wrong that was not the issue.

THe fixed code is

<cfquery datasource="xxxx" name="addResult">

                  INSERT INTO OAREI_results (poll_ID, question_ID, answer_text, votes)

            VALUES (<cfqueryparam value="#FORM.QuestionID#" cfsqltype="cf_sql_varchar" />,

                                <cfqueryparam value="#FORM.QuestionID#" cfsqltype="cf_sql_varchar" />,

                                <cfqueryparam value="#trim(FORM.Other)#" cfsqltype="cf_sql_varchar" />,

                    <cfqueryparam value="1" cfsqltype="cf_sql_varchar" />)

        </cfquery>

Translate
BKBK
Community Expert
Community Expert
Dec 23, 2012 3:36 PM UTC

Thanks for sharing the solution with us.

Translate
Inspiring
Dec 16, 2012 7:23 PM UTC

In the line that starts with "insert", your opening bracket is the wrong type of bracket.

Translate