⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

update after delete not working



rischan
  • profile picture
  • Member

Posted 08 November 2012 - 18:40 PM

i have 2 table for example:
mhs (id,name, address, status);
detail_mhs(id_detail, id_status)
id_status foregn key to status on mhs table.

my problem, when i delete data on detail_mhs i wanna update data on mhs table..


$crud->callback_after_delete(array($this, 'set_sudah_jadi_dua'));
function set_sudah_jadi_dua($primary_key){

$query = $this->db->query("UPDATE KKN_MHS SET SUDAH='2' WHERE NO=(SELECT NO FROM KKN_DETAIL_KELOMPOK WHERE ID_DETAIL_KELOMPOK='$primary_key')");
return $query;
}



where is my mistake?, I know that call back after deleting only use 1 parameter its table's primary key,
so my query like this:
"UPDATE KKN_MHS SET SUDAH='2' WHERE NO=(SELECT NO FROM KKN_DETAIL_KELOMPOK WHERE ID_DETAIL_KELOMPOK='$primary_key')"