in reply to DBI - check erroneous statement?

I think you mean something like
$sth->execute() or warn ("execute error: $DBI::errstr");