문제

I am starting out with PRADO php framework and i have a quick question: How to get the Primary Key of the last inserted record? My codes are as follow:

$studentRecord = new StudentRecord;
$studentRecord->Name = $this->txtName->SafeText;
$studentRecord->ContactNumber = $this->txtContactNo->SafeText;
$studentRecord->save();
// $studentId = ???

Thanks!

도움이 되었습니까?

해결책

I don't use Prado but normally with Active Record pattern implementations the objects are refreshed when saved. Does $record->id (or whatever your pk col is) not work?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top