0

我有一个带有 auto_incrementing 列的表,该列设置为主键。是否可以在插入活动记录后从该列中获取数字,而无需运行另一个查询?

$payment = new Model\Payment;
$payment->userId = $userId;
$payment->item = $item;
$payment->state = 'I';

$insert_id =

$payment->save();
4

1 回答 1

6
$payment->save();
$insert_id = $payment->id;
于 2012-11-24T10:30:46.317 回答