Add new SQL record, then retrieve that record's index, for further update, in PHP

Hi

I have a table in a SQL Express database which has an incrementing index field.
What I need to do is to add a new record, but get that record's unique incremented index so that I can display this number, then write subsequent updates to the same record. I need to make sure the 'last record added' that the information comes from is for the particular user and not just the last record on the database, as this may be different - for example if multiple users are adding multiple records at around the same time.

I am using PHP with MS SQL Express 2008.

How would I achieve this?

Thanks
Dave
LVL 1
davidcowlerAsked:
Who is Participating?
 
Ross TurnerConnect With a Mentor Management Information Support AnalystCommented:
0
 
Ross TurnerManagement Information Support AnalystCommented:
Have a look at this

http://sqlfiddle.com/#!3/af151/3
0
 
davidcowlerAuthor Commented:
Super :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.