Records being deleted in Order Details table
hi there, i thought my syste, was woking properly until i started looking at a order history page. What it is doing now is that the "orders" table in mysql is populating normally however the Orderdetails table is only recording the most recent order. It is actually deleting the previous order. Another big thing is that the OrderID column in the Orders table is supposed to match the DetailOrderID in the orderdetails table but they do not match. It is now actually writing them as "0" (number zero). I know this worked for a while.
Any ideas as to why it would stop recording to the orderdetails table?
I guess the orderdetails table is supposd to copy this number over or should i be creating a proper invoice number somehow?
I have attached my cart files to have a look but I have no idea why it would stop working.