简体   繁体   English

执行数据库查询时出错。 MySql,Dreamweaver和Coldfusion

[英]Error Executing Database Query. MySql, Dreamweaver and Coldfusion

I am trying to insert data into my database, but keep getting error 1064. Which goes like this: 我正在尝试将数据插入数据库中,但始终收到错误1064。如下所示:

You have an error in your SQL syntax; 您的SQL语法有误; 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 检查与您的MySQL服务器版本相对应的手册,以找到在第1行的“ Add,Username,TalkID)VALUES(“ trial”,“ andy”,2)附近使用的正确语法

The error occurred in C:\\ColdFusion8\\wwwroot\\cfGossip\\Gossip.cfm: line 18 错误发生在C:\\ ColdFusion8 \\ wwwroot \\ cfGossip \\ Gossip.cfm:第18行

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

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

18 : < cfelse> 18: <cfelse>

19 : NULL 19:空

20 : < /cfif> 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. 它说错误在第18行-但是我看不到任何问题。

Both the username and TalkID are hiddenfeilds, Username is from a session variable and the TalkID from another recordset on the page. 用户名和TalkID都是隐藏字段,用户名来自会话变量,而TalkID来自页面上的另一个记录集。 Thanks for any help. 谢谢你的帮助。

I think the problem is that ADD is a reserved word in MySQL. 我认为问题在于ADD在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 参见: http : //dev.mysql.com/doc/refman/5.1/en/reserved-words.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM