Sounds like a good case for a multi dimensional array.
$customers[$customer_id]["NAME"] = "Joe";
$customers[$customer_id][$order_id][$item_id]["NAME"] = "Gizmo";
So you have an array called $customers, the first dimension is a unique identification number for your customer. The second dimension is a unique identification number for an order that this customer placed, or it can be information about the customer as I did above with "NAME". The third dimension is going to be the unique identification number for a particular item that the customer ordered with this order, you could also put other order specific information here like date/time, shipped, etc. Then under the third dimension you can have a 4th dimension that tells you about the item that was ordered like name, cost, qty, etc.
Using this array you can rebuild any order that the customer has ever places. Unfortunatly this could end up being a huge array which will cost you in processing time.
But by doing it this way now you can access any information you stored in the array using just 3 keys ($customer_id, $order_id, $item_id).