首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

thinkphp,事务回滚解决办法

2012-03-22 
thinkphp,事务回滚function test(){$withdraw M(Withdraw)$withdraw-startTrans()$data[agent_id]

thinkphp,事务回滚
function test(){
$withdraw = M('Withdraw');
$withdraw->startTrans();

$data['agent_id']=1;
$data['money']=1222;

$withdraw->add($data);

$withdraw->rollback();
}

[解决办法]
你那数据应该没插进去吧,$withdraw->rollback();回滚了
[解决办法]
$withdraw->startTrans();
$withdraw = M('Withdraw');
$withdraw->add($data);
if(成功){
$withdraw->commit();
}else{
$withdraw->rollback();
}

////////////////////////////////////

热点排行