Hello,

I have a DBD syntax error, and of course I can't see the problem. The code containing the little bugger contains 3 long INSERTS each with about 300 names, place holders and variables each.

Just as a preview, here's the error

DBD::mysql::db do failed: You have an error in your SQL syntax; check +the manual that corresponds to your MySQL server version for the righ +t syntax to use near ')' at line 1 at /www/htdocs/click1003/app/strin +gform.pl line 144.

From reading other posts and replys I found in searching, more code means more help. but this may be kind of big. Would it be better to post a link to a textfile?

Thanks,
- dstefani

UPDATE 08-24

Well, using DBI->trace for the first time was an enlightening experience. It let me see a few things that I needed to look into, as mentioned in one of the replies, there was an extra comma, but it could only be seen when the place holders where replaced with the real values in the trace output. (very cool). It has to do with my ignorance with proper SQL. As a self taught hack, you tend to learn what you need to know.

This has been a great stop on the learning path, I may have it straightened out now, if I don't I'll trim down one of the queries and make a PC post (monks PC that is)

Thank you all for your input, always valuable.

- dstefani

2005-08-26 jdporter unconsidered (Keep/Edit/Delete: 8/19/0). Consideration was: Change name to "Debugging DBD syntax error"

2005-08-26 jdporter Moved to SoPW.

Retitled by g0n from 'Posting a Question: best practices'.


In reply to Debugging DBD/SQL syntax error by dstefani

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.