You were close to it.

But he way to get the last inserted item on AUTO_INCREMENT field is for
example:

id = mysql_insert_id(&mysql);
printf("The last insert is: %d\n", id);

And mysql is what was return to you when you open your connection to the
database.

Daniel



> 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
>
> gives me error. I tried to find something in the doc, but it does
> not really
> help.
>
> Please help.
> Thanks in advance.
> Reuben D. Budiardja
>
> ---------------------------------------------------------------------
> 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
>


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