Welcome Guest, Not a member yet? Register   Sign In
Transactions with Model
#1

(This post was last modified: 11-23-2022, 10:38 PM by kenjis.)

Hi, everyone knows how to use transaction, right?

Code:
<?php

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

But the truth is will be more useful to use transaction with the model. Something Like This:

Code:
$UserModel->db->transStart();

$UserModel->save($user);
$ProfileModel->save($profile);

$UserModel->db->transComplete();

But this approach seems not work. Anyone advice?
Reply


Messages In This Thread
Transactions with Model - by RedWd - 11-19-2022, 07:43 AM
RE: Transactions with Model - by InsiteFX - 11-19-2022, 11:49 PM
RE: Transactions with Model - by RedWd - 11-23-2022, 06:29 PM
RE: Transactions with Model - by kenjis - 11-23-2022, 10:40 PM
RE: Transactions with Model - by RedWd - 11-24-2022, 02:57 AM
RE: Transactions with Model - by kenjis - 11-25-2022, 02:40 PM
RE: Transactions with Model - by kenjis - 11-25-2022, 11:18 PM
SOLVED Transactions with Model - by RedWd - 11-27-2022, 01:37 AM
RE: SOLVED Transactions with Model - by nfaiz - 11-27-2022, 08:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB