Pdo V2.0 Extended Features [iPhone Pro]
Beyond the Basics: Mastering PDO v2.0 Extended Features for Modern PHP
try $pdo->query("INVALID SQL"); catch (PDOException $e) echo $e->getMessage(); // "SQLSTATE[42000]: Syntax error" $prev = $e->getPrevious(); if ($prev instanceof MySQLDriverException) echo "MySQL error code: " . $prev->getCode();