RE: [PEAR] DB.php version of mysql_insert_id()
| From: | Torsten Roehr | Date: | Thu, 18 Dec 2003 21:38:02 +0000 |
| Subject: | RE: [PEAR] DB.php version of mysql_insert_id() | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9689@lists.php.net to get a copy of this message | ||
Hi Mike,
I can't answer your question but there is a very good workaround. Use the
sequence functions of DB to get the ID prior to inserting so that you can
use the ID afterwards for inserts in other tables. This is much safer than
mysql_insert_id() because there could have been another insert between the
first insert and the mysql_insert_id() call. See the documentation for how
to work with sequences. It's very, very easy.
Regards, Torsten
> -----Original Message-----
> From: Mike Zornek [mailto:listguy@mikezornek.com]
> Sent: Tuesday, December 16, 2003 9:07 PM
> To: PEAR
> Subject: [PEAR] DB.php version of mysql_insert_id()
>
>
> I use mysql_insert_id() in PHP to retrieve the ID of the last INSERTed
> record. I'm trying to do this in PEAR's DB.php but can't see how.
>
> http://www.php.net/manual/en/function.mysql-insert-id.php
>
> Little help?
>
> ~ Mike
> Web Designer, Media Developer, Programmer and Geek
> http://MikeZornek.com
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>