summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/queries.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-02 14:45:41 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-02 14:45:41 +0100
commit4be5de1d11eefd9f0b7cf0589a2942f067cefe35 (patch)
tree6b360e221710377c2de0f3360e6c11a9ba1e9d6b /user_guide_src/source/database/queries.rst
parentbcb3bbb97c8c046f80009a2bd8dffb96795ed239 (diff)
Replaced DB methods _error_message() and _error_number() with error() (issue #1097)
Diffstat (limited to 'user_guide_src/source/database/queries.rst')
-rw-r--r--user_guide_src/source/database/queries.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst
index 971d5d61d..15a73614a 100644
--- a/user_guide_src/source/database/queries.rst
+++ b/user_guide_src/source/database/queries.rst
@@ -112,3 +112,20 @@ The secondary benefit of using binds is that the values are
automatically escaped, producing safer queries. You don't have to
remember to manually escape data; the engine does it automatically for
you.
+
+***************
+Handling Errors
+***************
+
+$this->db->error();
+===================
+
+If you need to get the last error that has occured, the error() method
+will return an array containing its code and message. Here's a quick
+example::
+
+ if ( ! $this->db->simple_query('SELECT `example_field` FROM `example_table`'))
+ {
+ $error = $this->db->error(); // Has keys 'code' and 'message'
+ }
+