Cakephp get last insert id


Cakephp get last insert id : If you working with cakephp database and performing insert operation tables you often need to get last inserted id because it is important for further processing. Here we are going to explain the last inserted id when you are performing the insert operation in cakephp.


Cakephp get last insert id Syntax

You can use You can get last inserted in cakephp as below-

:

$lastInsertedId =  $this->ModelName->getInsertID();

Or You can also use the below method to get last Insert Id.

:

$lastInsertedId =  $this->ModelName->getLastInsertID();

You Can use either method to get the last insert id in cakephp


Advertisements

Add Comment

📖 Read More