$sql = ‘INSERT INTO `table1`(`customerID`, `advertisementID`, `consumedStatus`, `consumedTime`) VALUES (:customerID,:advertisementID,:consumedStatus,:consumedTime);
UPDATE `table2` SET `consumedTimes`= `consumedTimes` + 1 WHERE `advertisementID`= :advertisementID;
UPDATE `table3` SET `appAdPoint`=`appAdPoint` + :price WHERE `customerID` = :customerID‘;
$command = $connection->createCommand($sql);
$command->bindParam(‘:customerID‘, $customerID);
$command->bindParam(‘:advertisementID‘, $advertisementID);
$command->bindParam(‘:consumedStatus‘, $consumedStatus);
$command->bindParam(‘:consumedTime‘, date(‘Y-m-d H:i:s‘));
$command->bindParam(‘:price‘, $price);
$updateStatus = $command->execute();
$command->execute();
注意:
原文:http://www.cnblogs.com/wlemory/p/4678933.html