Re: mysql_insert_id() and PEAR
| From: | Tomas V.V.Cox | Date: | Tue, 03 Apr 2001 00:42:52 +0000 |
| Subject: | Re: mysql_insert_id() and PEAR | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-32@lists.php.net to get a copy of this message | ||
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);
?>
Cheers,
Tomas V.V.Cox