Sorry for my english but please i need help i have a problem when i'm trying to catch an insert query
i have a table Employe with 3 primary keys (Matricule , CIN , name)
i want to catch the exception when i add a new employe with duplicated values
My Model
function insert_Employe($donnees){
try{
$this->db->insert('Employe',$donnees);
return 'employe enregistré avec succes';
}catch(Exception $e)
{
return $e->getMessage();
}
}
My controller
function nouveau(){
if(!$this->offres->_isLogged() || !$this->input->post('Ajax')==1){
redirect(base_url().'users');
}
$values = $this->_get_values();
try{
$message = $this->employe->insert_Employe($values);
echo $message;
}catch(Exception $e){
echo $e->getMessage();
}
}
i can't catch the exception