Home Backend Development PHP Tutorial thinkphp multi-table transactions detailed explanation_PHP tutorial

thinkphp multi-table transactions detailed explanation_PHP tutorial

Jul 21, 2016 pm 03:05 PM
function thinkphp affairs code copy Detailed explanation

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...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to copy lyrics from QQ Music How to copy lyrics How to copy lyrics from QQ Music How to copy lyrics Mar 12, 2024 pm 08:22 PM

How to copy lyrics from QQ Music How to copy lyrics

Detailed explanation of obtaining administrator rights in Win11 Detailed explanation of obtaining administrator rights in Win11 Mar 08, 2024 pm 03:06 PM

Detailed explanation of obtaining administrator rights in Win11

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

How to run thinkphp project

GE universal remote codes program on any device GE universal remote codes program on any device Mar 02, 2024 pm 01:58 PM

GE universal remote codes program on any device

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

There are several versions of thinkphp

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

How to run thinkphp

Detailed explanation of division operation in Oracle SQL Detailed explanation of division operation in Oracle SQL Mar 10, 2024 am 09:51 AM

Detailed explanation of division operation in Oracle SQL

How to install thinkphp How to install thinkphp Apr 09, 2024 pm 05:42 PM

How to install thinkphp

See all articles