summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/queries.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-05 13:23:57 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-05 13:23:57 +0100
commit74496c268ae7199082cad86e0fea65687d78a2c9 (patch)
tree7a02e9961dda1e6949c4cbd986c894ffb9ed15a3 /user_guide_src/source/database/queries.rst
parentbb5dae46256cdcb0bcd204b6fa2fc628da6afb88 (diff)
parentcc5af53346397846f2035dc2bf6a2c2f9b0cd4ab (diff)
Merge upstream branch
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'
+ }
+