When you print $ins_rec to your screen what do you get? Could you post the exact output of printing $ins_rec?

You should be using placeholders. Use DBI, prepare the statement, and then execute it by including the bind values as $sth->execute() bind params.

What I expect to find when you show us the contents of $ins_rec is something in your big string full of interpolation sending an unescaped metacharacter to MySQL that corrupts the SQL query statement. That, along with the potential for intentional SQL injection attacks is why Placeholders and Bind Values exist (well, efficiency and convenience too).

Per your OP update: I realize you're using DBI, but you may not be using it safely. You have to either use DBI's quote() method on the data you're instering, or you rework your prepare() to use placeholders, and your execute() to provide the bind values.


Dave


In reply to Re: MySQL INSERT in Perl by davido
in thread MySQL INSERT in Perl by baperl

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.