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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -