transitions - codeigniter transaction is not working -


i using codeigniter transaction. wrote function not working.it supposed complete transaction while submitting form. not saving code.with out transition code working. how can fix this:

  public function twotable_insertdata() {             $this->db->trans_start();             $data = array(                 'brand_name' => $this->input->post('f_name'),                 'brand_user_name' => $this->input->post('l_name'),              );              $brand_id = $this->m_common->insert_row('brands', $data);             echo '$brand_id';             $data1 = array(                 'brand_id' => $brand_id,                 'stadium_id' => $this->input->post('stadium'),                 'concession_stand_no' => $this->input->post('con_std_no'),              );             $this->m_common->insert_row('concession_stands', $data1);             redirect('backend/brand/view_brand');             if ($this->db->trans_status() === false) {                 $this->db->trans_rollback();             } else {                echo $this->db->trans_complete();             }         } 

i have updated query...

$this->db->trans_start(); $data = array(     'brand_name' => $this->input->post('f_name'),     'brand_user_name' => $this->input->post('l_name') );  $brand_id = $this->m_common->insert_row('brands', $data); //  echo '$brand_id'; $data1 = array(             'brand_id' => $brand_id,             'stadium_id' => $this->input->post('stadium'),             'concession_stand_no' => $this->input->post('con_std_no') ); $this->m_common->insert_row('concession_stands', $data1); $this->db->trans_complete(); if($this->db->trans_status() === false){    // check if transaction result successful    $this->db->trans_rollback();    $this->session->set_flashdata('failure', 'transaction fails.'); }else{    $this->db->trans_complete();    $this->session->set_flashdata('success', 'transaction success.'); }    redirect('backend/brand/view_brand'); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -