views:

22

answers:

1

Tried to get it that way inside extended model:

$this->lastInsertId();

and getting this error:

Fatal error: Call to undefined method InsertAd::lastInsertId()

Data is added successfully to the database, but i can't get auto_incremented key.

+1  A: 

lastInsertId is a method of the adapter.

$id = $this->getAdapter()->lastInsertId($stuff);
Iznogood
But in manual is written, that i can call that method from extended instance of Zend_Db_Table_Abstract.Anyway Thanks.
Beck
@Beck well you are. $this is an instance of Zend_Db. You are using its adapter to do stuff but are still in it. Best I can come up with to explain this. Does it work for you??
Iznogood
Yes it's working, thank you.
Beck