Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-05-28
3
Medium Priority
?
406 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 800 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

926 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