RE: [PEAR] Id from insert query
| From: | Sam Liddicott | Date: | Thu, 16 May 2002 09:46:11 +0000 |
| Subject: | RE: [PEAR] Id from insert query | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1387@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Trond Arve Nordheim [mailto:trond@nordheim.no]
> Sent: 15 May 2002 20:18
> To: Iwan Birrer
> Cc: pear-general@lists.php.net
> Subject: Re: [PEAR] Id from insert query
>
>
> On Wed, May 15, 2002 at 09:08:11PM +0200, Iwan Birrer wrote:
> > Hello,
> > How do I get the id from a insert query with PEAR DB? With
> mysql it was
> > mysql_insert_id().
>
> You obtain the ID before inserting using the nextID() function (e.g.
> $dbh->nextID("sequence_name")). See
> http://pear.php.net/manual/en/core.db.nextid.php for more
> information.
Does this work accross all backend dbs? What about race conditions etc when
two pages try to insert?
Sam