php pdo exceptions code example
Example 1: pdo turn on errors
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Example 2: php pdo error handling
$database -> errorInfo()[0] # SQLSTATE error code (a five characters alphanumeric identifier defined in the ANSI SQL standard).
$database -> errorInfo()[1] # Driver-specific error code.
$database -> errorInfo()[2] # Driver-specific error message.