summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/queries.rst
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-03-04 20:45:14 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-03-04 20:45:14 +0100
commit0f2cb79b976086cb73140c25f4c568e865177426 (patch)
treee67e0247e540ea8be6c7b37f627c4b13c0f0a586 /user_guide_src/source/database/queries.rst
parentef38f0a6d83025fbd99ace5ec60311acfe9121c4 (diff)
parente30e400581a663045486985d0e75bc77631a2ef2 (diff)
Merged develop and fixed conflicts.
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'
+ }
+