http://qs321.pair.com?node_id=11129037


in reply to Insert into mysql database

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?


🦛