diff options
Diffstat (limited to 'user_guide_src/source/database/queries.rst')
-rw-r--r-- | user_guide_src/source/database/queries.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index 90f49afb1..b9152aac7 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -132,6 +132,12 @@ 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. +Bindings also work with array values, useful for queries involving the IN operator:: + + $sql = "SELECT * FROM some_table WHERE id IN ? AND status = ? AND author = ?"; + $this->db->query($sql, array(array(3, 6), 'live', '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 |