Re: Getting the primary key from a MySQL insert
| From: | Daniel Kullik | Date: | Fri, 16 Jul 2004 10:40:21 +0000 |
| Subject: | Re: Getting the primary key from a MySQL insert | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190694@lists.php.net to get a copy of this message | ||
Here you can find an overview of all existing MySQL functions in PHP:
http://www.php.net/mysql
And this is the function you are looking for:
http://www.php.net/manual/en/function.mysql-insert-id.php
And please take your time to look at this posting:
http://marc.theaimsgroup.com/?l=php-general&m=108986762507986&w=2
Daniel
Andrew Wood wrote:
If the primary key in a MySQL DB is an autoincrementing integer, is there anyway of automatically getting it back when I do an insert in PHP. In other words taking the status returned by mysql_query and extracting the PK of the record we just entered?-- WWE e-commerce IT GmbH Eiffestrasse 462, D-20537 Hamburg Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50