Welcome Guest, Not a member yet? Register   Sign In
Codeigniter transaction doesn't roll back
#1

[eluser]alex646[/eluser]
Hey guys,


I would appreciate if somebody could clarify this for me:

I have a simple transaction:

Code:
$id = $data['id'];
        $name = $data['name'];
        $value = $data['value'];
        $apikey = $data['apkey'];
        $now = date("Y-m-d H:i:s");
      
  //test transactions here
        $this->db->trans_start();
        $this->db->query("UPDATE data SET feed_name ='$name', feed_value='$value' WHERE feed_id = '$id'");
        $this->db->query("UPDATE feeds SET date_updated ='$now' WHERE feed_id = '$id' AND apikey = '$apikey'");
        
        $this->db->trans_complete();
       return $this->db->trans_status() === FALSE ? FALSE : TRUE ;
        //test transactions here
    }

The problem with this transaction is that data is updated in data table but fails to update in feeds table. Should this transaction rollback and not update only one of the tables?

Thanks!!!


Messages In This Thread
Codeigniter transaction doesn't roll back - by El Forum - 01-04-2014, 09:53 PM
Codeigniter transaction doesn't roll back - by El Forum - 01-05-2014, 06:31 AM
Codeigniter transaction doesn't roll back - by El Forum - 01-05-2014, 09:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB