Re: mysql_insert_id() and PEAR
| From: | (Stig Sæther Bakken) | Date: | Tue, 03 Apr 2001 02:49:39 +0000 |
| Subject: | Re: mysql_insert_id() and PEAR | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-33@lists.php.net to get a copy of this message | ||
["Tomas V.V.Cox" <cox@idecnet.com>]
> Emil Rasmussen wrote:
> >
> > Hi
> >
> > It could be me that is missing somthing, but I cant seem to find a way to
> > retrive the last inserted id via PEAR, or some how pass the result pointer
> > to mysql_insert_id() function.
>
> If you still want to use insert_id, I think this should work:
>
> <?php
> $db = DB::connect($dsn);
> $res = $db->query("insert bla bla");
> $last_id = mysql_insert_id($db->connection);
> ?>
NB! Strictly speaking, this is unsupported usage of DB. Please don't
rely on it.
- Stig
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway