summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-03-02 15:07:04 +0100
committerTimothy Warren <tim@timshomepage.net>2012-03-02 15:07:04 +0100
commitd33dab14c5d812d30f48d9a5f6324bb230e77203 (patch)
tree9f56e656e54c68d4a971b7985269f3c1cba1c696 /user_guide_src/source/database
parenteabc5ec81209ec83393222f2964098aedf6dbc7a (diff)
parent4be5de1d11eefd9f0b7cf0589a2942f067cefe35 (diff)
Merge upstream
Diffstat (limited to 'user_guide_src/source/database')
-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'
+ }
+