我从PRADO php框架开始,我有一个简短的问题:如何获得最后插入的记录的主键?我的代码如下:
$studentRecord = new StudentRecord;
$studentRecord->Name = $this->txtName->SafeText;
$studentRecord->ContactNumber = $this->txtContactNo->SafeText;
$studentRecord->save();
// $studentId = ???谢谢!
发布于 2010-08-23 23:35:19
我不使用Prado,但通常使用活动记录模式实现时,对象会在保存时刷新。$record->id (或者不管你的pk列是什么)不能工作吗?
https://stackoverflow.com/questions/3549058
复制相似问题