Welcome Guest, Not a member yet? Register   Sign In
Update until 2 and no more...
#1

[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?


Messages In This Thread
Update until 2 and no more... - by El Forum - 08-11-2012, 10:24 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 10:36 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 11:02 AM
Update until 2 and no more... - by El Forum - 08-11-2012, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB