开发者

How to get primary key after calling ActiveRecord save() method PRADO?

开发者 https://www.devze.com 2023-01-12 22:47 出处:网络
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:

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 = ???

T开发者_C百科hanks!


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消