Add new SQL record, then retrieve that record's index, for further update, in PHP
Posted on 2013-05-28
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?