如下所示:
复制代码 代码如下:
function makeAcquire($nUsers,$nAwards)
{
//更新数据库
$tranDb = new Model();
$tranDb->startTrans();
for($i = 0; $i {
//更新表Acquire
$flagAc = $tranDb->table('Acquire')->add($acquire);
//更新表Users
$where = array('u_id'=>$nUsers[$i]['u_id']);
$flagU = $tranDb->table('Users')->where($where)->setInc('u_man_count',1);
//更新表Award
$where = array('a_id'=>$nAwards[$i]['a_id']);
$flagA = $tranDb->table('Award')->where($where)->setDec('a_count',1);
}
if($flagAc && $flagU && $flagA)
{
$tranDb->commit();
}
else
{
$tranDb->rollback();
}
}
http://www.bkjia.com/PHPjc/327670.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327670.htmlTechArticle如下所示: 复制代码 代码如下: function makeAcquire($nUsers,$nAwards) { //更新数据库 $tranDb = new Model(); $tranDb-startTrans(); for($i = 0; $i sizeof($nUsers); $i...