Hello if you want to get last insert id or something equivalent to this you can try following steps:-
Lets take this example, Here I just inserted the field in column
$data = array('menuName' =$_REQUEST['menuname'])
$this->Menu->create();
$this->Menu->save($data);
$id = $this->Menu->getLastInsertId();
And you want the id on which this last record has been inserted, for this you can do it in many ways but the best method for fetching the last inserted id is like
$this->User->id;
Here the model name is user, and when its updated it will store the inserted id in variable id,
And you can also do this by giving the model function name then it will return the last insert id and model data also
$this->User->getLastInsertId(); $this->User->getInsertID();
0 Comment(s)