grabbing autoinc ref on newly inserted record

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
muppet
Forum Newbie
Posts: 22
Joined: Sun Jan 25, 2004 2:01 pm

grabbing autoinc ref on newly inserted record

Post by muppet »

Hi, treat me gentle please - I'm new to this.

I have a form that inserts a new record into mysql table which uses an autoincrement field as it unique identifyier. Is there anyway to grab and return the unique indentifier ref. when the record is inserted. I want to be able to tell the user the reference for the record they have just inserted.

My thoughts are that I cannot do it by finding the previous record and adding one as other users on the site will be adding records at the same time.
I've got a horrible feeling that someone will look at this and think - "DOH - thats basic stuff!!!!" but like i say i'm new to this.

Any help muchly appreciated 8O
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

muppet
Forum Newbie
Posts: 22
Joined: Sun Jan 25, 2004 2:01 pm

Post by muppet »

Many thanks.
Post Reply