[eluser]Unknown[/eluser]
Helloo....
How to use throw exception in CodeIgnitier...
this is my code......
function insert() {
try {
$this->db->trans_start();
$this->nim = $this->input->post('nim');
$this->nama = $this->input->post('name');
$this->db->insert('student', $this);
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
throw new Exception('error');
} else {
$this->db->trans_commit();
}
$this->db->close;
} catch (Exception $e) {
log_message('debug', $e->getTrace());
}
}
I use the code above, but when things go wrong, why not go directly to the exception
example: duplicate entry error
any solution????
thanks for your help...