Isn't it always 1? Is it possible to insert multiple rows at once?

Regards,
Saša Stamenković


On Sat, Jul 18, 2009 at 6:05 PM, Juozas <juo...@juokaz.com> wrote:

> Hi,
>
> how about lastInsertId()? http://framework.zend.com/manual/en/zend.db.html
>
> $db->insert('bugs', $data);
>
> // return the last value generated by an auto-increment column
> $id = $db->lastInsertId();
>
>
> --
> Juozas Kaziukėnas (juo...@juokaz.com)
> Aš internete - JuoKaz (http://www.juokaz.com)
>
>
>
> On Sat, Jul 18, 2009 at 4:59 PM, debussy007 <debussy...@gmail.com> wrote:
>
>>
>> Hello,
>>
>> When I insert a record in a table like $db->insert('my_table', $data); I
>> would like to get the new id generated.
>> ($db is the Db Adapter)
>>
>> What is the best way to achieve this ?
>>
>> When I was using Zend_Db_Table_Abstract I just had to do return
>> $myTable->insert ... and the insert method would return the new id.
>>
>> However the insert method of the Zend_Db_Adapter_Abstract won't return the
>> new id but the number of rows affected (which will always be 1 I guess
>> ...)
>> --
>> View this message in context:
>> http://www.nabble.com/Getting-the-id-generated-after-insert-tp24549260p24549260.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>

Reply via email to