Zend Framework: How to retrieve the id of the last inserted row?

后端 未结 4 553
醉酒成梦
醉酒成梦 2021-01-17 13:06

I\'m inserting a new row into my database with this code:

$data = array(
    \'key\' => \'value\'
);
$this->getDbTable()->insert($data);
         


        
4条回答
  •  情书的邮戳
    2021-01-17 13:40

    Try below code:

    To insert data:

    $this->tableGateway->insert($data);
    

    Get Last Inserted value:

    $this->tableGateway->lastInsertValue;
    

提交回复
热议问题