Welcome Guest, Not a member yet? Register   Sign In
Error Handling while using $this->db->insert
#1

[eluser]Unknown[/eluser]
<?php
class imrtrackerModel extends CI_Model {

private $imrmain= 'imrmain';

function imrtracker(){
parent::__construct();
}

function save($imrtracker){
try
{
$rc_save = $this->db->insert($this->imrmain, $imrtracker);
echo 'outside error';
if (! $rc_save)
{
throw new Exception();
}
}

catch (Exception $e)
{
echo 'exception';
}

}

}
?>

The above is my model code. I want to capture the duplicate entries. But i am not able to handle the error. Kindly help me. Am new to Codeigniter.
#2

[eluser]InsiteFX[/eluser]
CodeIgniter User Guide - Query Helper Functions
#3

[eluser]Mauricio de Abreu Antunes[/eluser]
You dont need to catch exceptions.
If you need to check duplicate entries, run your sql command to get duplicate entries.




Theme © iAndrew 2016 - Forum software by © MyBB