List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 1 2001 2:50am
Subject:Re: How To call mysql_insert_id
View as plain text  
At 6:45 PM -0500 9/30/01, Reuben D Budiardja wrote:
>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()
>Select mysql_insert_id() from TABLE_NAME

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


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

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

Paul DuBois, paul@stripped
How To call mysql_insert_idReuben D Budiardja1 Oct
  • RE: How To call mysql_insert_idDaniel Ouellet1 Oct
  • Re: How To call mysql_insert_idPaul DuBois1 Oct