Re: SQL>Insert and recover the ID
| From: | 1LT John W. Holmes | Date: | Thu, 31 Oct 2002 21:41:25 +0000 |
| Subject: | Re: SQL>Insert and recover the ID | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122339@lists.php.net to get a copy of this message | ||
> In a table, I have some fields and the primary key is an autoincrement
> field. I insert an row and I'd like to recover the ID used for the last
> record I inserted.
>
> For the moment, I do a select max(Id) just after the insert but there
> is, my be a best way to do it.
Stop.
Read this:
www.php.net/mysql_insert_id
---John Holmes...