Solved

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

Posted on 2013-05-28
3
399 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql query questions 2 44
SQL Server 2012 r2 - Query results have 2 seperate results instead of 1 2 34
Re-appearing SQL Server Agent jobs 7 31
TSQL convert date to string 4 39
     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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