At 2:43 AM +0000 10/31/01, Curtis Gordon wrote:
>I have a query where I am inserting a record into a db, and would 
>like to have the primary key
>value returned, I have been reading and reading, but I can't seem to find
>any mention of this. I would think that this would be useful. Can anybody
>help?

You can't get the primary key value returned from the INSERT statement
itself.  But (assuming the key is an AUTO_INCREMENT column), you can
issue this query after the INSERT to get the value:

SELECT LAST_INSERT_ID()

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to