Skip to main content
Known Participant
December 16, 2012
Question

UPDATE a database errror

  • December 16, 2012
  • 2 replies
  • 1464 views

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 has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
December 23, 2012

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

Known Participant
December 23, 2012

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>

BKBK
Community Expert
Community Expert
December 23, 2012

Thanks for sharing the solution with us.

Inspiring
December 16, 2012

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