I have my table proveedor
with a field called status
1 active 0 removed, I only update when removing
delete:
$data => array('status' => 0);
$this->db->update('proveedor',$data);
Try changing the update to delete
$this->db->delete('proveedor',$id);
The problem is that when there is data related to that provider, it marks me an error. There will be some way of knowing if that provider is related to another table, and if so just change status
otherwise you can use delete
and thus avoid unnecessary records.
The restrictions I have in my BDD is
ON DELETE restrict, ON UPDATE cascade