Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server assigned consecutive number. Is it possible?

Status
Not open for further replies.

monkey64

Technical User
Apr 27, 2008
69
GB
I am working on a multi-user web based project which will assign a consecutive number to an order.

I have been using a database auto-increment field to get a guaranteed consecutive number. It works well, but I have some questions:

What happens if two users submit at exactly the same nano-second. How would the server react?

Is there a better way to acheive this? Could the server itself generate a consecutive number?

 
Hi

This question has nothing to do with PHP.

Anyway, no need to care about. That is why the database server handles this, so you can concentrate your attention on the business logic.


Feherke.
 
What happens if two users submit at exactly the same nano-second. How would the server react?

They'll get a packet collision. I suspect one gets through, or they must both try again.

Seriously, multi-user thingies is what server databases are for. Read the docs of your database server.


+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top