That\'s the source code, I need to detect the ID (see the marked position between the two queries below).
$connection = Yii::app()->db; $transaction=$conn
you can try both way,here getLastInsertID is method and lastInsertID is property
$lastInsertID = $connection->getLastInsertID();
or
$lastInsertID = $connection->lastInsertID;
for more info http://www.yiiframework.com/doc/api/1.1/CDbConnection