What is the equivalent to getLastInsertId() in Cakephp?

后端 未结 22 735
囚心锁ツ
囚心锁ツ 2020-11-28 11:00

If I do getLastInsertId() immediately after a save(), it works, but otherwise it does not. This is demonstrated in my controller:

f         


        
22条回答
  •  时光说笑
    2020-11-28 11:42

    I think it works with getLastInsertId() if you use InnoDB Tables in your MySQL Database. You also can use $this->Model->id

提交回复
热议问题