[eluser]Alhazred[/eluser]
I have a table with a field called "banner" defined as
int not null default 0
this field must be incremented after some operations, this is the update query
Code:
$set = array('banner' => $row['banner']+1); //$row['banner'] contains the old number of banners
$this->db->where('id',$row['id']);
$this->db->update($table,$set);
if ( $this->db->affected_rows() == 1)
{
$inserzione['active_banner']--;
}
else //update error
{
$this->db->trans_rollback();
return FALSE;
}
It works until $row['banner']+1 is 1 or 2, next time the update must be performed it doesn't work.
I've checked and $this->db->affected_rows() is 1, but the else is executed and I don't get why.
What can I try to do to understand the problem?