I have apply manual query in cakephp and not get last generate id
My query is this
$areas = $this->Area->query("insert into areas (Area_ID,Parent_Area_ID,Area) values ('','".$Parent_Area_ID."','".$Area_name."')");
How i get last id ?
I have apply manual query in cakephp and not get last generate id
My query is this
$areas = $this->Area->query("insert into areas (Area_ID,Parent_Area_ID,Area) values ('','".$Parent_Area_ID."','".$Area_name."')");
How i get last id ?
Try this
echo $this->Area->getLastInsertID();
If this doesn't work check out this answer from a similar question
Try this code:
$this->Area->getInsertID();
More detail here:
http://book.cakephp.org/2.0/en/models/additional-methods-and-properties.html#model-getinsertid