php - Why my codeigniter code about transaction does not work? -
my code liked this:
$this->db->trans_strict(false); //close strict mode $this->db->trans_begin(); $updatearr = array('name'=>'test', 'age'=>22); $this->db->where('user_id', $user_id); $this->db->limit(1); $this->db->update('user_table', $updatearr); $logarr = array('created'=>'2015-07-30', 'content'=>'test' ); $this->db->set($logarr)->insert('log_table'); if ($this->db->trans_status() === false) { $this->db->trans_rollback(); return false; } else { $this->db->trans_commit(); return true; }
- does codeigniter transactions support activerecord?
- when first query
return false
, why second queryreturn true
?
what doing wrong ? please me.
i use mysql innodb
Comments
Post a Comment