This is a simple SQL insert...
$insert_cmd = "INSERT INTO PhoneNumbers (cusID, adtID, pntID, phnPart1, phnPart2, phnPart3, phnExt) VALUES (?, ?, ?, ?, ?, ?, ?)"; $phone_insert = $gcssDBH->prepare($insert_cmd); ... $phone_insert->execute( $row->{'cust_id'}, $adtID, $phoneNumberTypes->{'Day'}, $row->{'cust_phac'}, $row->{'cust_phpx'}, $row->{'cust_phsx'}, $row->{'cust_phex'} );
...but I get this error: You have an error in your SQL syntax near '89, '45')' at line 4 (line 4 of the query, that is)

...with these values assigned to the variables:
$row->{'cust_id'} == 3048770 adtID == 2 pntID == 3 $row->{'cust_phac'} == 704 $row->{'cust_phpx'} == 53 $row->{'cust_phsx'} == 2 89 $row->{'cust_phex"} == 45
I don't see anything wrong with the code. Does something jump out at you? Yes, $row->{'cust_phsx'} == "2 89" but I don't see why that should make a difference. Obviously, I'm wrong. I'm under the impression that using placeholders gives me the right to avoid explicitly escaping naughty characters.

In reply to Using placeholders, getting unexpected SQL errors by ok

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.