At 6:45 PM -0500 9/30/01, Reuben D Budiardja wrote:
>Hi,
>I am a newbie in MySQL. I use an auto_increment to insert to one of the
>column. How do I get the value inserted?
>
>The documentation seems to suggest using mysql_insert_id() function. But when
>I tried to call it using
>Select mysql_insert_id()
>or
>Select mysql_insert_id() from TABLE_NAME

mysql_insert_id() is the C API function for obtaining that value.
Use LAST_INSERT_ID() instead:

SELECT LAST_INSERT_ID()

You don't want "SELECT LAST_INSERT_ID() from TABLE_NAME", probably.
That will give you the insert-id value once for each row in TABLE_NAME.

>
>gives me error. I tried to find something in the doc, but it does not really
>help.


http://www.mysql.com/doc/M/i/Miscellaneous_functions.html

>
>Please help.
>Thanks in advance.
>Reuben D. Budiardja


-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
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