On Wed, 31 Oct 2007, Gontran Zepeda wrote:

> % On 2007-11-01 at 01:05:15 +0100, Peter Lukezic wrote:
> > but in the database components i?m looking for something to get the id of my
> > last insert statement? perhaps someone could help...
> > eg.
> > 
> > $q = $this->db->createInsertQuery();
> > $q->insertInto( '_nic2006' )
> > ->set( 'id', $q->bindValue( ) )
> > ->set( 'plz', $q->bindValue( '1010' ) )
> > ->set( 'ort', $q->bindValue( "wien" ) );
> > $stmt = $q->prepare();
> > $stmt->execute();
> 
> Caveats apply, ymmv, but this is in the docs.
> 
> $my_id = $this->db->lastInsertId();

I don't recall if it's in the docs, but as $stmt is a normal 
PDOStatement, all methods of that class work of course as well. 
The documentation for prepare() lists this: 
http://ez.no/doc/components/view/latest/(file)/Database/ezcQuery.html#prepare
But I will add a link to the PDOStatement documentation there.

regards,
Derick
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to