By default any error that occurs on a MySQL call via PDO fails quietly. The caller must inspect $pdo->errorCode()
to see if the call succeeded/failed. This behaviour can be changed by setting the ATTR_ERRMODE attribute either while constructing the PDO object or after construction via setAttribute.
1 2 |
$options = array(PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION); $pdo = new PDO($dsn, $username, $password, $options); |