Hey guys. I've got an issue here that is confusing me. Here is what I am trying to do.
On a page is a list of car parts with a drop down that has a list of vendors to choose from next to each part. Once the user has selected the parts they want to order by choosing a vendor for each part they hit the submit button.
On the next page I get two arrays...the first array is an array of PartsID's that was stored on the previous page in a hidden text field this is needed so I know which parts to update in the database.
The second array is an array of VendorID's which were chosen in the drop downs.
Now I have to group the VendorID's together that are the same to create a PurchaseOrderID for each Vendor.
The PurchaseOrderID is dynamicaly created by getting the MAX(PoID) form the parts table and then adding 1 to it for each new PurchaseOrder.
For example, in the parts table there are these fields
PartID, PoID, VendorID, PartName
When I create a new PurchaseOrder it would look something like this
PartID PoID VendorID
1---------1---------3
2---------1---------3
3---------1---------3
4---------2---------5
5---------2---------5
6---------3---------8
So I have an array of PartID's and an Array of VendorID's and I need to group the VendorID's together to create a single poID for that group and up date the parts with the VendorID PoID on the correct PartID. Then do the same thing for the next group of Vendors that have the same VendorID untill I have gone thru the whole array and created PoID's for each different VendorID.
I know that is confusing hehe, but hopefully someone has some experience doing something like this. I just cant wrap my head around it.
Thanks guys!😕