so have code db transactions:
$to_return = true; $this->db->trans_begin(); $this->insert_arrest_details($data); $this->update_barangay($data['barangay_id']); $this->insert_arresting_officers($data); $folders = $this->insert_violators($data); $this->insert_arrest_booking_form($data); $this->insert_case_report($data); $this->insert_seizing_officers($data['case_id'],json_decode($data['seizing_officers'])); $this->insert_items(json_decode($data['items'])); $this->insert_nitems(json_decode($data['nitems'])); $this->insert_violator_items(json_decode($data['items'])); $this->insert_violator_nitems(json_decode($data['nitems'])); if($this->db->trans_status() === false){ $array['error_message'] = $this->db->_error_message(); $array['error_number'] = $this->db->_error_number(); $this->db->trans_rollback(); $to_return = $array; }else{ $img_success = $this->move_violators_images($folders); $img_success = $this->move_items_images($data['case_id']); $img_success = 1; if($img_success == 1){ $this->db->trans_commit(); }else{ $this->db->trans_rollback(); $to_return = false; } } return $to_return; my problem is, if error (for example) occurs in $this->insert_arrest_details(); code doesn't error. returns this:
"error_message":"","error_number":0
but when tried run 1 method , method failed, code able error. why so?
your responses appreciated.
Comments
Post a Comment