Tutorialsplane

Codeigniter delete multiple rows


Codeigniter delete multiple rows– You can use where condition to delete the multiple rows from the table.


Codeigniter delete multiple rows Query Example

Use where_in and pass array of values that you want to delete. Here is simple example-

Example:

$ids = array(1,8,7,5);
$this->db->where_in('id', $ids);
$this->db->delete('my_table');

Where $ids is array, my_table is table name from which you want to delete the data. The above example will delete the where id is 1,8, 7 and 5.