Re: Retrieving newly created ID from MySQL?
| From: | Foong | Date: | Thu, 27 Mar 2003 04:26:37 +0000 |
| Subject: | Re: Retrieving newly created ID from MySQL? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141166@lists.php.net to get a copy of this message | ||
hello
just call:
mysql_insert_id();
right after you execute a insert statement
Foong
"Ben Cheng" <kenshin@mac.com> wrote in message
news:4B27901C-600B-11D7-8D9C-000393414116@mac.com...
> If I have a MySQL table with an auto-incrementing ID field, is there an
> easy way to retrieve the new ID after I insert a new row into the
> table? For example, if I insert a row into a table with ID, Title, &
> Content fields, is there a way I can get the ID value without doing a
> separate select where the Title & Content fields are equal to the
> values I just inserted?
>
> -Ben
>