Welcome Guest, Not a member yet? Register   Sign In
Active Record Insert Duplicate
#2

[eluser]Armchair Samurai[/eluser]
I'd ignore AR in this case and do something like this:
Code:
$sql = "INSERT INTO table_name (foo, bar)
        VALUES (?, ?)
        ON DUPLICATE KEY UPDATE foo = foo";
$this->db->query($sql, array($var1, $var2));

return $this->db->affected_rows() == 1 ? TRUE : FALSE;
and handle the error in the controller if it returns FALSE.


Messages In This Thread
Active Record Insert Duplicate - by El Forum - 02-27-2008, 08:46 PM
Active Record Insert Duplicate - by El Forum - 02-27-2008, 09:19 PM
Active Record Insert Duplicate - by El Forum - 02-28-2008, 12:53 PM
Active Record Insert Duplicate - by El Forum - 02-29-2008, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB