How transaction in codeIgniter works? can I stop once transaction and start one another?
See my example
$this->db->trans_begin(); $a = 'UPDATE ......'; RETURN TRUE $b = 'INSERT INTO......'; RETURN FALSE $this->db->trans_rollback(); // I tried $this->db->trans_off(); var_dump( $this->db->trans_status() ); $this->db->trans_begin(); if ( $this->db->trans_status() === FALSE ) { $this->db->trans_rollback(); } else { $this->db->trans_commit(); } My first transaction will always return FALSE (even it is true I need to rollback it) ,now I need to close that transaction and need to start another one.
The problem is with $this->db->trans_status() , it always returns FALSE on the second transaction (even after $this->db->trans_rollback() or trans_off()).
what am I doing wrong ? Please help me.
I am using mySql as underlying database.
var_dumpyou're usingtrans_statusrather thantrans_status()innodbor not?config/database.phpand if yes what is the error you are getting?