The manual excerpt you are quoting is from the insert method of Zend_Db_Adapter_* classes, _NOT_ Zend_Db_Table, which you are using in your code example.

On 16/01/2009 10:27 AM, buttie wrote:
Hi There

The manual suggests that you should not rely on the result of insert()
method for last inserted id:

"13.1.4.2. Retrieving a Generated Value
Some RDBMS brands support auto-incrementing primary keys. A table defined
this way generates a primary key value automatically during an INSERT of a
new row. The return value of the insert() method is not the last inserted
ID, because the table might not have an auto-incremented column. Instead,
the return value is the number of rows affected (usually 1)."

However whenever I make use of insert() I always retrieve the id as return
value of insert() e.g.

$data = array('name'=>'tom');
$id = $table->insert($data);

And have never had a problem, am I missing something here?

Cheers

Tom

Reply via email to