As shown below:
Copy code The code is as follows:
function makeAcquire($nUsers,$nAwards)
{
//Update database
$tranDb = new Model();
$tranDb->startTrans();
for($i = 0; $i < sizeof ($nUsers); $i++)
{
//Update table Acquire
$flagAc = $tranDb->table('Acquire')->add($acquire ; tranDb->table('Users')->where($where)->setInc('u_man_count',1);
//Update table 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.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/327670.htmlTechArticle is as follows: Copy the code as follows: function makeAcquire($nUsers,$nAwards) { //Update database$ tranDb = new Model(); $tranDb-startTrans(); for($i = 0; $i sizeof($nUsers); $i...