From 763c810f70ad6406c36dae381a85974f45ec7765 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 10 Jul 2011 20:20:09 +0000 Subject: [PATCH] Include an example of how to set the PDO error mode git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@313120 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo/error-handling.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/reference/pdo/error-handling.xml b/reference/pdo/error-handling.xml index 5e526cf376..9d7cd596b2 100644 --- a/reference/pdo/error-handling.xml +++ b/reference/pdo/error-handling.xml @@ -72,6 +72,31 @@ containing the SQLSTATE code, the driver specific error code and driver specific error string. + + + &reftitle.examples; + + Create a PDO instance and set the error mode + +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} catch (PDOException $e) { + echo 'Connection failed: ' . $e->getMessage(); +} + +?> +]]> + + + +