$rows = $dbh->do($statement); if (!$rows) { YourLogError($dbh->err, " ", $dbh->errstr); RedirectToYourErrorPage(); }