CodeIgniter Forums
How to pass DB exception from Model across Controller and show in the view? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to pass DB exception from Model across Controller and show in the view? (/showthread.php?tid=60194)



How to pass DB exception from Model across Controller and show in the view? - El Forum - 02-03-2014

[eluser]Soporte[/eluser]
Hello everybody,

anybody can help me with my problem. I don't know how show in the view the database exception.
In the model, I have the next code:

$result=$this->db->delete('lineatra', array('ip' => $ip));
$data = array();
if ($result==true){
$data['error']="";
}
else{
$data['error']=$this->db->_error_message();;
}
return $data;

and in the controller

$datos=$this->ventas->graba_lineas_facturas_modelo();
print $datos['error'];

But I don't know how show the error in the view.
Thanks in advance for any help !

Fernando



How to pass DB exception from Model across Controller and show in the view? - El Forum - 02-03-2014

[eluser]Unknown[/eluser]
I think it is because of the double ";" in the end of the error message syntax...