Finding auto-increment value after inserting

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Dave_will
Forum Newbie
Posts: 5
Joined: Mon Sep 22, 2003 4:07 am
Location: UK

Finding auto-increment value after inserting

Post by Dave_will »

I'm sure I've seen how do do this but forgotten where.

How can you find the value of an auto-increment field after inserting a record without accessing the DB?

Thanks
Dave_will
Forum Newbie
Posts: 5
Joined: Mon Sep 22, 2003 4:07 am
Location: UK

Whoops - Found answer in a previous posting

Post by Dave_will »

Original search didn't find answer due to my misstype... Sorrey all
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

For those who follow:

In PHP: mysql_insert_id()
In MySQL: LAST_INSERT_ID()

Mac
Post Reply