Best Approach to Generate Unique Order Number with concurent inserts in Sales Application - Mysql/PHP -


we have sales application generating unique order number adding increment in previous value. since using unique combination based on orderid , store id, can not use auto increment. sometime getting duplicate order ids if request submitted multiple client devices.

can please advise better way handle order id generation based on order id , store id? using php scripting language.

this have of now.

// table structure  salesorders (order_id, store_id)  $generatenextorderid = "select max(order_id) + 1 salesorders store_id = 1"; 

any suggestions?


Comments

Popular posts from this blog

javascript - Feed FileReader from server side files -

c++ - What's the differece between of link to a dynamic file and as a input object? -

How to pass json object using PHP in Wepay API -