Welcome Guest, Not a member yet? Register   Sign In
Codeigniter transactions with multiple functions
#3

(06-21-2017, 07:59 AM)skunkbad Wrote: Looks like it should work fine. CodeIgniter doesn't care where you start and finish your transaction.

What does it mean, from the moment the transaction starts until it ends, regardless if I use functions, CI is able to detect that?

I've seen this example in a POST comment, it looks like it may also be an option, but I want to be sure to do this.

Example and the code:

http://www.itgo.me/a/9149152029127615409...ansactions

PHP Code:
$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();

Reply


Messages In This Thread
RE: Codeigniter transactions with multiple functions - by funcion - 06-21-2017, 08:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB