Welcome Guest, Not a member yet? Register   Sign In
Transaction
#1

Hi sorry for english , can i insert in a transaction a simple method instead of db statement ? 
For example i want rollback if a mail was not been send...
Reply
#2

Yes you can do commit or rollback manually. Read this: http://codeigniter.com/user_guide/databa...s-manually
PHP Code:
$this->db->transBegin();

$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');

if (
$this->db->transStatus() === false) {
    $this->db->transRollback();
} else {
    $this->db->transCommit();

CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB