'Syntax error in INSERT INTO statement' - simple statement - cant find error

Discussion in 'Programming' started by angrypenguin, Dec 1, 2006.

  1. #1
    Hi all,

    I had the above error message when I have tried to enter information from a form into a database. The code I've got is like this:

    <cfinsert datasource="site" formfields="name,email,comments,postid,date" tablename="comments_section">

    I know that the datasource can be found becuase I can read the data from that particular table. I'm a bit lost - can anyone help?

    Thanks in advance,
    Andy
     
    angrypenguin, Dec 1, 2006 IP
  2. JasonBartholme

    JasonBartholme Peon

    Messages:
    396
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi Andy,

    I don't immediately see an error in your code, but as a rule of thumb I don't use <cfinsert>. I prefer using the SQL syntax for my inserts. You can have better control over the data going into the table.

    Hope this helps,
    Jason
     
    JasonBartholme, Dec 7, 2006 IP
  3. swirl1980

    swirl1980 Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    agree with above, leave sql to sql and cf to cf!!!
     
    swirl1980, Dec 8, 2006 IP
  4. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #4
    yup - definitely agree - I've had issues with cfinsert in the past - just don't use 'em anymore -
     
    datropics, Dec 16, 2006 IP