diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:57:43 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-04-06 23:57:43 +0200 |
commit | 05fa61144667c85b0463f7e8baa6af00aa195dc6 (patch) | |
tree | 2a611231c945ce7fd5bd021e3491dd973794f58e /user_guide | |
parent | 08b5169a5181706156c9a53229d164d9fa3aea32 (diff) |
Made Environment Support optional. Comment out or delete the constant to stop environment checks.
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/changelog.html | 1 | ||||
-rw-r--r-- | user_guide/database/active_record.html | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 013c55766..26e9bbc3b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -68,6 +68,7 @@ Hg Tag: n/a</p> <ul> <li class="reactor"><kbd>constants.php</kbd> will now be loaded from the environment folder if available.</li> <li class="reactor">Added language key error logging</li> + <li class="reactor">Made Environment Support optional. Comment out or delete the constant to stop environment checks.</li> <li class="reactor">Added Environment Support for Hooks.</li> <li class="reactor">Added CI_ Prefix to the <a href="libraries/caching.html">Cache driver</a>.</li> </ul> diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index dc06c87be..64596e271 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -545,6 +545,30 @@ $this->db->insert_batch('mytable', $data); <p>The first parameter will contain the table name, the second is an associative array of values.</p> +<h2>$this->db->insert_batch();</h2> +<p>Generates an insert string based on the data you supply, and runs the query. You can either pass an +<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p> + +<code> +$data = array(<br/> + array(<br /> + 'title' => 'My title' ,<br /> + 'name' => 'My Name' ,<br /> + 'date' => 'My date'<br /> + ),<br /> + array(<br /> + 'title' => 'Another title' ,<br /> + 'name' => 'Another Name' ,<br /> + 'date' => 'Another date'<br /> + )<br/> +);<br /> +<br /> +$this->db->update_batch('mytable', $data); +<br /><br /> +// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code> + +<p>The first parameter will contain the table name, the second is an associative array of values.</p> + <p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p> |