good day guys,
I have an order table and some stuffs, and the user can cancel an order. my question is:
1.] what is the best implementation of canceling an order in a database? Im sure I must create a table for canceled order or something right?
2.]Is it appropriate to delete the canceled order in the order table and move it to the "tblCancel" or just copy the canceled order to the "tblCancel"?

thanks in advance for your help, Good day!

Recommended Answers

All 3 Replies

I would just add a tinyint field to your orders table that represents the status of the order. 0 = ordered, 1 = cancelled, 2 = shipped etc. Then when you want to view your outstanding orders, just filter according to the status of the order. This implementation allows you to keep a "paper trail" of every order, regardless of whether it was actually carried out.

hey, thanks for the reply, so easy.I will try that out now.

//any other ideas are still acceptable :D

You are better to put a OrderCancelledDate field in the table. It provides more information to the user. If is is null then the order has not been cancelled.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.