1 thought on “How to get the Last Inserted ID in Table in Cakephp

  1. CakePHP has two methods for getting the last inserted id:
    Model::getLastInsertID() and
    Model::getInsertID().
    Actually these methods are identical so it really doesn’t matter which method you use.

    echo $this->ModelName->getInsertID();
    echo $this->ModelName->getLastInsertID();

Leave a Comment