I want to use the built-in PDO class to connect to a mysql database.
If I understand it right, the PDO methods don't throw exceptions by default. Is this correct?
So I try to change the error mode:
$pdo = new PDO($dsn, $user, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
My problem is that I'm using namespaces in my classes so I have to write:
$pdo = new \PDO($dsn, $user, $password);
But I don't know how to set the error mode in this context.