Re: DB.php version of mysql_insert_id()
| From: | Massimiliano Bariola | Date: | Thu, 18 Dec 2003 23:47:38 +0000 |
| Subject: | Re: DB.php version of mysql_insert_id() | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9692@lists.php.net to get a copy of this message | ||
Hello Mike,
Thursday, December 18, 2003, 6:42:55 PM, you wrote:
MZ> Sorry, if this a repeat post, my messages weren't going through (as far as I
MZ> could tell) and have now re-subscribed to the list.
MZ> I use mysql_insert_id() in PHP to retrieve the ID of the last INSERTed
MZ> record. I'm trying to do this in PEAR's DB.php but can't see how.
MZ> http://www.php.net/manual/en/function.mysql-insert-id.php
MZ> Little help?
The DB object has a "connection" member which is the mysql resource.
Try this:
$db = DB::connect(DSN);
$l_id = mysql_insert_id($db->connection);
It works for me.
Bye!
--
Best regards,
Ing. Massimiliano Bariola Cell: ++39 329 3570098
REDLINK Italia S.a.s
http://www.redlinkitalia.it mailto:m.bariola@redlinkitalia.it
PGP Key:
http://www.redlinkitalia.it/PGP/MB_PGPKEY.txt