I want that if i delete the one row from the list page of grocery crud, it check that if this acc_no used in another table, it show a message and not delete otherwise delete.
I use "callback_before_delete" but not working.
Here my code is attached:
$this->grocery_crud->callback_before_delete(array($this,'delete_check'));
function delete_check($post_array,$primary_key)
{
$id = $primary_key;
//$acc_no = $post_array['acc_no'];
$this->db->select('acc_no');
$this->db->where('id',$id);
$query = $this->db->get('lib_book');
foreach ($query->result() as $row)
{
$acc_no = $row->acc_no;
}
$this->db->where('acc_no',$acc_no);
$query1 = $this->db->get('booking');
if($query1->num_rows() > 0)
{
return false;
}
else
{
return true;
}
}
I don't know--is this appropriate process?
Help please.