getting an auto increment value immediately after insert
| From: | garman | Date: | Mon, 06 Aug 2001 21:03:43 +0000 |
| Subject: | getting an auto increment value immediately after insert | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-61493@lists.php.net to get a copy of this message | ||
Hello:
I'm inserting some information into a MySQL database via a PHP script. A
handful of various information is put into the database via the "INSERT
INTO..." SQL command. Each entry has a unique, auto increment field that acts
as an index number for that entry. I can't seem to figure out a clean and
simple way to get that index number immediately after an insert.
Granted I have a lot of field information that I could use in a very specific
SELECT statement's WHERE clause. And the chances of that information being
identical to another is virtually zero. However, I would like something a bit
more "elegant," i.e., a function like "mysql_get_inserted_row ()".
If anyone has any suggestions, they would be sincerely appreciated!
Thanks,
Matt