Re: getting an auto increment value immediately after insert
| From: | James, Yz | Date: | Mon, 06 Aug 2001 21:29:46 +0000 |
| Subject: | Re: getting an auto increment value immediately after insert | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61495@lists.php.net to get a copy of this message | ||
Hi Matt,
mysql_insert_id();
See the manual for more info.
James
"Garman" <garman@students.uiuc.edu> wrote in message
news:3B70907D@webmail.uiuc.edu...
> 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
>