thinkphp3.2.3使用事物

public function _initialize(){
  $this->m = M('Abc');
}
public function add4(){
  $this->m->startTrans();
  $info1 =    $this->m->where(array('id'=>100))->find();
  $info2 = $this->m->add(array('value'=>'6666'));
  if($info1 && $info2){
    $this->m->commit();
    echo 'sql执行成功';
  }else{
    $this->m->rollback();
    echo 'sql执行失败';
  }

}

 

 

posted on 2017-07-14 10:53  炊厨  阅读(678)  评论(0)    收藏  举报

导航