From 05fa61144667c85b0463f7e8baa6af00aa195dc6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 6 Apr 2011 22:57:43 +0100 Subject: Made Environment Support optional. Comment out or delete the constant to stop environment checks. --- user_guide/changelog.html | 1 + user_guide/database/active_record.html | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'user_guide') 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

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);

The first parameter will contain the table name, the second is an associative array of values.

+

$this->db->insert_batch();

+

Generates an insert string based on the data you supply, and runs the query. You can either pass an +array or an object to the function. Here is an example using an array:

+ + +$data = array(
+   array(
+      'title' => 'My title' ,
+      'name' => 'My Name' ,
+      'date' => 'My date'
+   ),
+   array(
+      'title' => 'Another title' ,
+      'name' => 'Another Name' ,
+      'date' => 'Another date'
+   )
+);
+
+$this->db->update_batch('mytable', $data); +

+// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')
+ +

The first parameter will contain the table name, the second is an associative array of values.

+

Note: All values are escaped automatically producing safer queries.

-- cgit v1.2.3-24-g4f1b