CodeIgniter Forums
Constraint Error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Constraint Error (/showthread.php?tid=62716)



Constraint Error - calcio - 08-18-2015

Hi everyone, I got a Constraint Error, I Know the motive and I think how to fix it. But I need get a handle erro. CI only show the message below.


Error Number:
DELETE FROM GCC_CONTRATOS WHERE ID_CONTRATO = '124'
Filename: /vagrant/gcc/models/contratos_model.php
Line Number: 183

My question is. Where the error number? How to get it? How to show a friendly message to my users?

I use CI 2.x with Oracle.

Thanks in advanced.


RE: Constraint Error - Wouter60 - 08-18-2015

Try this:
PHP Code:
echo $this->db->_error_message();
echo 
$this->db->_error_number(); 



RE: Constraint Error - calcio - 08-19-2015

Hi @Wouter60 these commands don't work here using oracle.

I tried it to forces it handler an error.


PHP Code:
$this->db->where('ID_CONTRATO'$idContrato);
 
       //$query = $this->db->delete($this->tabela);
 
       if (!$this->db->delete($this->tabela)) {
 
           echo $this->db->_error_message();
 
           echo $this->db->_error_number();
 
       }

 
       exit

Even using try ... catch don't work too.


PHP Code:
try {
 
           $query $this->db->delete($this->tabela);
 
       } catch (Exception $e) {
 
           var_dump($e);