I have processing db transaction from page using ajax request if user don't press submit button than roll-back all sql transaction which is done by ajax request (i will manage this but currently following logic not working if refresh current page).
I have try following code but not working,
function viewPage(){
$needRollBack=$this->session->userdata('needRollBack');
if($needRollBack){
$this->db->trans_rollback();
}
$this->db->trans_begin();
$this->MyModel1->insert(.....);
$this->MyModel2->insert(.....);
.........................
}
function submitDetails(){
$this->db->trans_complete();
$this->session->set_userdata('needRollBack',false);
}
when again viewPage()
function call or refresh page than if submitDetails()
not called than rolleback all sql stransaction done via ajax request (starting point from trans_begin()) will be roll-baked?
is this possible? Kindly guide me...