summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-11-11 13:33:16 +0100
committerAndrey Andreev <narf@devilix.net>2014-11-11 13:33:16 +0100
commit8f7d3d2fccc097c85cc403b58df6c5fc35418579 (patch)
tree5bc1ef2a75abb0d85a3ab2cece365eed9e516470 /user_guide_src/source/database
parent4f50256a84e8052fc3356683f28286d36f8a322c (diff)
parent81c934729d9fcbb294a8914608c315eed30ff9c4 (diff)
Fix merge conflicts
Diffstat (limited to 'user_guide_src/source/database')
-rw-r--r--user_guide_src/source/database/queries.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst
index 90f49afb1..76ff1083f 100644
--- a/user_guide_src/source/database/queries.rst
+++ b/user_guide_src/source/database/queries.rst
@@ -132,6 +132,15 @@ put the queries together for you. Consider the following example::
The question marks in the query are automatically replaced with the
values in the array in the second parameter of the query function.
+Binding also work with arrays, which will be transformed to IN sets::
+
+ $sql = "SELECT * FROM some_table WHERE id IN ? AND status = ? AND author = ?";
+ $this->db->query($sql, array(array(3, 6), 'live', 'Rick'));
+
+The resulting query will be::
+
+ SELECT * FROM some_table WHERE id IN (3,6) AND status = 'live' AND author = 'Rick'
+
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