[thelist] mysql/php: get auto-increment ID for record

Kae Verens kverens at contactjuggling.org
Thu Feb 27 03:24:01 CST 2003


Aleem Bawany wrote:
> I am inserting a record into a mysql DB and leaving
> the ID field blank since it's assigned automatically
> and is auto-increment. However, I need to use this
> ID in a subsequent query to insert into another
> table. Is there anyway to get the ID that MySQL
> picks for the first query and use that in the second
> query?

http://php.net/mysql_insert_id


--
Kae Verens               _______\_   webworks.ie
pay:  www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
  kae: kverens.contactjuggling.org _\\\\____ code




More information about the thelist mailing list