Blogger Information
Blog 40
fans 0
comment 0
visits 45777
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
TP3.2事物
无須終有的博客
Original
824 people have browsed it

1.多表操作
  //事务:表必须是innodb

    //删除主表
$mod1 = M('User');
//删除详情表
    $mod2 = M('Userdetail');
    $mod1->startTrans();//开启事务
    if(!$mod1->delete($id)){
    $mod1->rollback();
    $this->error('删除失败');
    
    }
    
    if(!$mod2->delete($id)){
    $mod2->rollback();
    $this->error('删除失败');
    }
    $mod1->commit();
    $mod2->commit();

psb.png

2.单表操作
psb (1).png

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post