How to delete a record in Codeigniter?

by cristobal , in category: Technology , 4 years ago

How to delete a record in Codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by bailey_conroy , 4 years 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);


Related Threads:

What is Active Record(AR) in yii ?
How To Delete Duplicate Rows From The Database Table?
When you press delete button, is a file actually deleted?
What Are the Key Features That Make Codeigniter Ideal for Rapid Php Application Development?
How to do 301 redirects in CodeIgniter?
How to check the version of CodeIgniter framework?