CodeIgniter事务没有响应

时间:2015-05-29 07:29:09

标签: php codeigniter

我正在使用codeigniter事务并使其正常工作。但是,当执行nothings时。这是我的代码:

public function submit($data){

    $to_return = true;
            $this->db->trans_begin();

            $this->insert_arrest_details($data);
            $this->insert_arresting_officers($data);
            $folders = $this->insert_violators($data);  
            $this->insert_arrest_booking_form($data);           
            $this->insert_inventory(json_decode($data['inventory']));
            $this->insert_items(json_decode($data['items']));   
            $this->insert_violator_items(json_decode($data['items']));  

            if($this->db->trans_status() === FALSE){
                $to_return = $this->return_error_message();
            }else{  
                $img_success = $this->move_violators_images($folders);
                $img_success = $this->move_items_images(json_decode($data['inventory']));
                $this->db->trans_commit();
            }       
            return $to_return;
        }

当我检查我的网络时,我的代码似乎无所事事我没有得到任何响应。甚至错误都没有出现。

似乎有什么问题?如果这是事务锁定,它应该在50秒后提示我(我在配置上设置它),但它不是。

非常感谢您的回复。

谢谢!

1 个答案:

答案 0 :(得分:0)

尝试执行该事务,然后返回状态。

    $this->db->trans_start();

    /*your code here*/

    $this->db->trans_complete();    

    return $this->db->trans_status();