Codeigniter Transactions

前端 未结 6 1743
离开以前
离开以前 2020-11-28 07:21

I\'m using Codeigniter transactions

$this->db->trans_start();
$this->db->query(\'AN SQL QUERY...\');
$this->db->trans_complete();
         


        
6条回答
  •  清酒与你
    2020-11-28 07:56

    What I tried was more of a trick, but it worked for me.

    $this->db->trans_begin();
      $rst1=  $this->utils->insert_function($data);
      $rst2 =  $this->utils->update_function2($test);
    if($this->db->trans_status() === FALSE || !isset($rst1) || !isset($rst2)){
       $this->db->trans_rollback();
    }else{
       $this->db->trans_commit();
    }
    

提交回复
热议问题