Re: Hi! PHP & SQL!
| From: | David Robley | Date: | Thu, 26 Jul 2001 00:35:27 +0000 |
| Subject: | Re: Hi! PHP & SQL! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59645@lists.php.net to get a copy of this message | ||
On Thu, 26 Jul 2001 09:47, Dana Holt wrote:
> Hello everyone,
>
> I am very new to PHP (only 2 days now!), and I am having a problem with
> MySQL.
>
> This is probably simple.
>
> Ok, I insert a new row into a database that has an AUTO_INCREMENT key
> defined.
>
> How to get the value of the AUTO_INCREMENT field of the row I just
> inserted? My database doesn't have any other columns that are
> guaranteed to be 100% unique. I need this value to create a file with
> data related to the row.
>
> Thanks in advance for any help!
mysql_insert_id is the function you want. Have a read through the mysql
section of the docs to see what other goodies are available. I suspect
mysql_error will be one you may find useful :-)
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
A camel is a horse planned by committee.