views:

136

answers:

1

I am trying to insert data into my database, but keep getting error 1064. Which goes like this:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Add, Username, TalkID) VALUES ( 'trial' , 'andy' , 2 )' at line 1

The error occurred in C:\ColdFusion8\wwwroot\cfGossip\Gossip.cfm: line 18

16 : , < cfif IsDefined("FORM.GossipsID") AND #FORM.GossipsID# NEQ "">

17 : < cfqueryparam value="#FORM.GossipsID#" cfsqltype="cf_sql_numeric">

18 : < cfelse>

19 : NULL

20 : < /cfif>

I'm not sure what I can do to fix it! It says the error is on line 18 - but I can't see any problems.

Both the username and TalkID are hiddenfeilds, Username is from a session variable and the TalkID from another recordset on the page. Thanks for any help.

A: 

I think the problem is that ADD is a reserved word in MySQL. rename your field (and your database column!) to a non reserved word

See: http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

Roland Bouman
yes! It's working now. Thanks.
Lucy