I want to delete 4,6,8,11,12 records by using model at a time. I also want to know how to do it without deleting the following records 3,5,6,7 by using model.
Controller Function
public function delete_data($id,$value){
$oris = explode("_", $value);
$oris = array_filter($oris);
$this->o->delete_data($oris);
}
Model Function
public function delete_data($id){
$this->db->where('campus_id', $id);
$this->db->delete('sections');
}
4,6,8,11,12 records Deleted
public function delete_data($id){
$this->db->where_in('campus_id', $id);
$this->db->delete('sections');
}
3,5,6,7 records not Deleted
public function delete_data($id){
$this->db->where_not_in('campus_id', $id);
$this->db->delete('sections');
}
Wow I Got It..
YOUR MODEL
public function delete_record() //You can pass ID as a parameter here
{
$this->db->where('column-name', 'your-id'); //id can be 4, 6, 8, 11, 12
return $this->db->delete('table-name');
}