Is this old Perl and not compatible with the newer version of MYSQL?

It's a style of Perl that is not often seen anymore, but that doesn't mean that it won't actually run - even with a modern target database. The problem is that your error message is going to be 'Could not execute SQL statement ... maybe invalid?' regardless of what the actual underlying cause is. That's no use for debugging. Consider something like this instead:

$sth->execute(@bargs) or die "Could not execute '$query' with argument +s '@bargs': " . $dbh->errstr;

That would give you already a lot more information about the problem. I've also passed an array of bind arguments @bargs to the execute call. This means using placeholders which is far, far safer than the prepare statement that you have. Definitely something else to look into.

The new server runs a newer version of PHP (version 7.X)

I do hope that's irrelevant. You aren't actually using the PHP for anything, are you?


🦛


In reply to Re: Insert into mysql database by hippo
in thread Insert into mysql database by NorCal12

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.