Skip to content

Instantly share code, notes, and snippets.

@chonthu
Created February 23, 2012 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chonthu/1893463 to your computer and use it in GitHub Desktop.
Save chonthu/1893463 to your computer and use it in GitHub Desktop.
on_duplicate_update 1
$exists = $this->db->select(‘id’)->where(‘id’, $id)->get()->row_array();
if($exists)
{
$this->some_model->add($data);
}
else
{
$this->some_model->update($data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment