[eluser]hjeffg[/eluser]
I also needed this functionality since I will be doing tons of inserts with only occasional duplicate entries that I want to handle separately. I don't think it's a great idea to have to do a 'get' to see if the record already exists each time.
SO.... I did the following:
I modified DB_active_rec.php by adding the function insert_quiet()
function insert_quiet($table = '', $set = NULL)
{
$oldv =$this->db_debug;
$this->db_debug = false;
$this->insert($table, $set);
$e = $this->_error_message();
$aff = $this->affected_rows();
$this->db_debug = $oldv;
if($aff < 1) {
return($e);
} else {
return(true);
}
}
Now, I know I *should* have done this by extending the class, but I wasn't sure how all the default database stuff that goes on would work with my extended class. Perhaps when I learn more, I'll do that. Or, if someone else knows how to, please advise. Meanwhile, this is working for me.