RE: [PHP] MySQL INSERT
| From: | Matthew Loff | Date: | Mon, 19 Nov 2001 04:34:28 +0000 |
| Subject: | RE: [PHP] MySQL INSERT | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75067@lists.php.net to get a copy of this message | ||
Did you check the PHP manual? Sounds to me like you just described the
mysql_insert_id() function verbatim.
http://www.php.net/manual/en/function.mysql-insert-id.php
-----Original Message-----
From: Justin French [mailto:justin@indent.com.au]
Sent: Sunday, November 18, 2001 11:21 PM
To: php
Subject: [PHP] MySQL INSERT
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net