in reply to Error while inserting null values with DBI
Use placeholders instead:
my $statement = $dbh->prepare('INSERT INTO test(id, name) VALUES(?,?)' +); $statement->execute($Id, $name);
This will work even if $Id is undef (if the db schema allows NULL values for id), or if $name contains quotes.
|
|---|