Solved

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

Posted on 2013-05-28
3
397 Views
Last Modified: 2013-05-28
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
0
Comment
Question by:davidcowler
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Ross Turner earned 200 total points
ID: 39201340
0
 
LVL 7

Expert Comment

by:Ross Turner
ID: 39201388
Have a look at this

http://sqlfiddle.com/#!3/af151/3
0
 
LVL 1

Author Closing Comment

by:davidcowler
ID: 39201590
Super :)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question