Use the lastInsertId() method. Or use fetchNew() to fetch a new row, save that, and retrieve the id from it.

Have a look here: http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.insert

MF


José de Menezes Soares Neto wrote:
Hi friends,

I am inserting a new record in a DB, but, I would like to retrieve the ID of the new record...

How can I do that?

                $data = array(
                        'fun_nome'        => $fun_nome,
                        'fun_cpf'         => $fun_cpf,
                        'fun_cep'         => $fun_cep,
                        'fun_observacoes' => $fun_observacoes,
                        'fun_data'        => date("Y-m-d h:i:s"),
                );
$funcionarios = new Funcionarios(); $funcionarios->insert($data); <------------------------------- here!

best regards,

José de Menezes


--
Maurice Fonk

[EMAIL PROTECTED]
http://naneau.nl/

Scio me nihil scire

Reply via email to