[eluser]Cristian Gilè[/eluser]
[quote author="lennierb5" date="1295148732"]I thought that if
Code:
$this->db->affected_rows() == 0 // Update query was ran successfully but nothing was updated
$this->db->affected_rows() == 1 // Update query was ran successfully and 1 row was updated
$this->db->affected_rows() == -1 // Query failed
So you should be able to check for 1 if you want to know if anything has been updated.[/quote]
Your assumption is not true. Here, an example:
Code:
$this->db->where('id',27);
$this->db->update('my_table',$some_data);
If id=27 doesn't exist the query doesn't fail and the return value for affected_rows is 0.
Cristian Gilè