How to delete a record in Codeigniter?

Member

cristobal

by cristobal , in category: Technology , a month ago

How to delete a record in Codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by bailey_conroy , a month ago

In Codeigniter, delete function is used to delete the one or more row data from a table.

1
2
3
4
5
6
7
8
9
//DELETE FROM table WHERE id = $id
$conditions =['id' => $id]
$this->db->delete('table_name', $conditions); 

// Deleting records from more than one tables in one go
$id=1;
$tables = array('table1', 'table2', 'table3');
$this->db->where('id', $id);
$this->db->delete($tables);