views:

182

answers:

2

Hi all, another CakePHP framework question...

how can I get ID of current record?

Tnx in advance!!!

+1  A: 

Basically if you wondering how to get ID of the record after the save action it's very easy.

if($this->MyModel->save($this->data)){
    //the id is here
    echo $this->MyModel->id;
}

HTH

Nik
tnx, but i don't need it after the save.i need to get ID there when i open details of some record, in edit or view layout.
A: 

ok, i got it!

it's

echo $modelName['ModelName']['id'];

tnx anw!