Re: Pear DB LastInsertID
| From: | Tomas V.V.Cox | Date: | Wed, 10 Jul 2002 15:58:25 +0000 |
| Subject: | Re: Pear DB LastInsertID | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1843@lists.php.net to get a copy of this message | ||
Pedro Furlanetto wrote:
>
> How about putting a new function into the MySQL Driver for PEAR DB,
> some thing like getLastInsertedId().
> IMHO using the native functions from the DB is more efficient then
> implamating a layer to emulate the beharvior of others DBs.
>
As you probably know, PEAR DB tries to provide a common API for all
backends and your solution will be only useful for MySQL, so we can't
add it. You always can do that:
$db->query("INSERT INTO foo VALUES ('blah')");
$id = mysql_insert_id($db->connection);
Tomas V.V.Cox