RE: [PEAR] PEAR::DB -> mysql_insert_id() ??
| From: | Lukas Smith | Date: | Mon, 27 Jan 2003 19:38:33 +0000 |
| Subject: | RE: [PEAR] PEAR::DB -> mysql_insert_id() ?? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3483@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Franz Pentenrieder [mailto:v-master@web.de]
> Sent: Monday, January 27, 2003 8:27 PM
> To: pear-general@lists.php.net
> Subject: [PEAR] PEAR::DB -> mysql_insert_id() ??
>
> hi
>
> is there any way to get the mysql_insert_id from the DB class ??
> i have tried the DB::nextId() but this returns not that what i want -
how
> can i get the auto_increment value ?
You can always access the connection property of your DB object to use
to run any of the native database methods.
However you may want to familiarize yourself with DB::nextId().
Most other RDBMS use so called sequences to provide unique id's.
These are stored separate of any RDBMS which also makes it possible to
use them more flexibly. Since MySQL does not have Sequences DB emulates
them. DB::nextId() creates a table for you automatically. So you don't
have to much in order to use them.
For further information a search in the archive will undoubtly reveal a
lot of hits.
Regards,
Lukas