how to catch any error when inserting data in PDO code example Example: pdo turn on errors $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);