PDA

View Full Version : Syntax error in UPDATE statement.



David Blake
29 Jun 2006, 10:40 AM
Hi-

I am working on a simple database using coldfusion language. I am getting a syntax error on line 134. Can anyone see what the problem is?

132 : SET Position='#Form.Position#',
133 : Description='#Form.Description#' ,
134 : Requirements='#Form.Requirements#'
135 : WHERE JobID=2
136 : </cfquery>

Thanks,
Dave

DanInManchester
17 Jul 2006, 08:30 AM
well there is no "UPDATE tablename" in what you have there but assuming you have this....

What are your variable values and are they safe for direct SQL input like that?
Not understanding PHP but assuming this is a fom request it could be that your input strings are unsafe. You should ALWAYS sanatise input strings or ideally use parameterised queries. Characters that usually cause problems are apostophies and semi colons.

It could also be a reserved word. again not knowing php or mySQL I don't know if this will work but try enclosing Position and description in square brackets as these are the most likely offenders.