From 41f60d44e37cc52d41a49d0d640f71761a82abe7 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 20 Dec 2007 20:09:22 +0000 Subject: Added the ability to pass an array of tables to the delete() statement in Active Record. --- user_guide/database/active_record.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'user_guide/database') diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index d938b5dff..e7c823fde 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -623,14 +623,16 @@ $this->db->delete('mytable', array('id' => $id));

The first parameter is the table name, the second is the where clause. You can also use the where() or or_where() functions instead of passing the data to the second parameter of the function:

- -$this->db->where('id', $id);
-$this->db->delete('mytable'); -

-// Produces:
-// DELETE FROM mytable
-// WHERE id = $id
- +

$this->db->where('id', $id);
+ $this->db->delete('mytable');
+
+ // Produces:
+ // DELETE FROM mytable
+ // WHERE id = $id

+

An array of table names can be passed into delete() if you would like to delete data from more then 1 table.

+

$tables = array('table1', 'table2', 'table3');
+$this->db->where('id', '5');
+$this->db->delete($tables);

Note: All values are escaped automatically producing safer queries.

-- cgit v1.2.3-24-g4f1b