13 Replies Latest reply: Apr 25, 2012 9:10 AM by Dan Bracuk RSS

    "Syntax error in INSERT INTO statement." comment posting error.

    Abidubbah

      I had this working perfectly on MySQL. Then I was told I needed to do it with an mdb database in Access, now errors are popping up like crazy. I fixed all except this one, I get a 'Syntax error in INSERT INTO statement.' when I try to post a comment on a post in my mini-blog site.

       

      The thing is, I use pretty much the exact same code for the comments that I do for the blog posts themselves. The posts work fine, the comments don't.

       

      It says the error is on my addcomment_process page on like 119. It's the following (line 119 is underlined, the bolded line is also bolded in the error message):

       

      <cfquery name="input_comments"

                          datasource="#DSN#"

                          username="#DSNUSER#"

                          password="#DSNPASS#">

       

      INSERT INTO comments(

                               commenter,

                               comment,

                               datetime,

                               post_id

                          )

                     VALUES(

                               '#form.commenter#',

                               '#form.comment#',

                               '#form.datetime#',

                               '#form.post_id#'

                         )

      </cfquery>

       

       

      It's getting all the data fine, just not inserting it, because it says:

      "INSERT INTO comments( commenter, comment, datetime, post_id ) VALUES( 'Anonymous', 'test comment.', '25-Apr-12 10:55 PM', '2' )"

       

       

      It worked perfectly when it was a MySQL database, now I keep getting errors with this one part of the site now that it's MDB. Anyone know what's going on?