variable $tablemodel
in an instance of a model which extends Zend_Db_Table_Abstract
, if i do
$tablemodel->insert($data)
to insert data. Is there any method or property to get last insert id?
regards
variable $tablemodel
in an instance of a model which extends Zend_Db_Table_Abstract
, if i do
$tablemodel->insert($data)
to insert data. Is there any method or property to get last insert id?
regards
try
$id = $tablemodel->insert($data);
echo $id;
you can use lastInsertId Method
echo 'last inserted id: ' . $db->lastInsertId();
$db
come from? –
Intracranial use after insert query
$this->dbAdapter->getDriver()->getLastGeneratedValue();
$insert_id = $this->db->getLastId()
worked for me
© 2022 - 2024 — McMap. All rights reserved.
insert
returns an int, but it's the number of affected rows not the last inserted row! – Viridity