summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/queries.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-03 02:52:16 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-03 02:52:16 +0100
commit8335a5db2a44b9272b066f524223b58904dd9f3f (patch)
tree688f1f0115c33bc65f40c5600e02f20b64d65537 /user_guide_src/source/database/queries.rst
parent718d9ef22c4663f59f6f43c8945944f1f165c800 (diff)
parent8e89df8f92444eb02dc73b6c3e66077a4fb3f710 (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'
+ }
+