[eluser]Wondering Coder[/eluser]
haha,
From searching all related thread here in CI about handling foreign key one of them says that I have to used InnoDB engine, btw I'm using the MySQL default engine MyISAM. Haven't tried it though. Is this really recommended?
Also by reading those user guide in CI I came across HELPERS. So what I did to solved this is just by using $this->db->insert_id().
My model
Code:
$this->db->insert('myTable', $data)
$item = $this->db->insert_id();
$this->save_detail($item);