MySQL INSERT
| From: | Justin French | Date: | Mon, 19 Nov 2001 04:21:20 +0000 |
| Subject: | MySQL INSERT | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75065@lists.php.net to get a copy of this message | ||
Hi,
I'm inserting into a table (as I've done millions of times), and I have
a column called "id", which is an auto incrementing, unique field.
Since it's auto-increment field, I have no idea what it is at the time
of insert, but I want to be able to report it to the screen.
"Thankyour for your application, for future reference, your application
# is "<the id number of the application i just inserted>."
So, what I'd like to do is INSERT, then find out the id of the row I
just inserted.
I can't just look up the most recent id, because it's *possible* that
someone else could have inserted after me.
Also, at this stage the id field is the only unique field, so I can't
try and match against annother field (of which I know the value I inserted).
Any ideas?
Justin French