Best way to save a ordered List to the Database while keeping the ordering

前端 未结 12 1091
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 17:27

I was wondering if anyone has a good solution to a problem I\'ve encountered numerous times during the last years.

I have a shopping cart and my customer explicitly

12条回答
  •  独厮守ぢ
    2020-11-30 18:00

    I would recommend keeping gaps in the order number, so instead of 1,2,3 etc, use 10,20,30... If you need to just insert one more item, you could put it at 15, rather than reordering everything at that point.

提交回复
热议问题