Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Incorrect Syntax

New Here ,
Mar 14, 2008 Mar 14, 2008
Below is the error I recieve - Im close because its passing the data through but it stops here. I have ticks by the email and reason on purpose. Pretty sure thats how it should be done. Thanks in advance for even looking at it.


Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Line 2: Incorrect syntax near ' '.

The error occurred in /var/www/vhosts/comapny/httpdocs/act_unsubscribe.cfm: line 14

12 : (Email, Reason, Date)
13 : Values
14 : ('#attributes.email#', '#attributes.reason#', getdate())
15 : </cfquery>
16 :
============================================
Code
TOPICS
Database access
608
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 14, 2008 Mar 14, 2008
You need to put getdate() within #'s; I think it has to go within the tick marks as well.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 14, 2008 Mar 14, 2008
I take that back, getdate() is an sql function (I totally knew that! I swear!)...

Well, it looks fine to me. The only thing I see that could be the problem with it is if attributes.email or attributes.reason had a tick mark in it.

Also, this is all within a <cfoutput> right? Just checking.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2008 Mar 14, 2008
It doesn't have to be within cfoutput. I'm guessing that attributes.reason has an apostrophe in it somewhere. cfqueryparam will fix that and give you some other benefits as well.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2008 Mar 15, 2008
You debug output shoudl also display the actual SQL statement being sent to
the DB driver. It'll be more clear from that what your problem is. I
suspect Dan is correct, though.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2008 Mar 15, 2008
Try using #dateformat(now())# instead of your getdate function and see if that works. If it does, the driver is choking on your trying to pass the function rather then an actual date.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2008 Mar 19, 2008
Hi, If you still can't resolve this put the whole SQL statements in a cfoutput tag and see what the query will be in runtime.Then it will be easy to debug.Also use #dateformat(now())# inside quotes.
HTH
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2008 Mar 19, 2008
LATEST
Hi,

Please try this #now()# instead of getdate()
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources