psychowolvesbane Posted April 20, 2008 Share Posted April 20, 2008 Hi, I was wondering if you could help me with creating an Amend table script that also involves adding new fields into the table being amended to. I have a ShopCart table with these fields CustID ProductID NUSDiscount OrderDate OrderQuantity and a table called OrderDetails that has the fields: OrderID CustID ProductID NUSDiscount ProdTitle ProdPrice ProdQuantity What I need is the fields CustID, ProductID, NUSDiscount, and OrderQuantity from the ShopCat table amended to the OrderDetails table based on the php variable $CustID (which you don't need to worry about) and then being able to hopefully in the same query string add the OrderID from another variable called $OrderID also obtained earlier. I will deal with the rest of the table later, it's just this amend part I need dealt with and I don't know how to do that with an INSERT as well. P.S. OrderQuantity is the same as ProdQuantity. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 21, 2008 Share Posted April 21, 2008 Why do you want to do this? Quote Link to comment Share on other sites More sharing options...
psychowolvesbane Posted April 21, 2008 Author Share Posted April 21, 2008 Well this is a shopping cart for a e-commerce site that I'm building. The shopping cart will only temporarily hold the details until the checkout, then they will be amended into the OrderDetails table but they will have a unique OrderNo added to each, so OrderNo, ProdID and CustID instead of just the last 2 in the shopping cart table. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 21, 2008 Share Posted April 21, 2008 Well this is a shopping cart for a e-commerce site that I'm building. The shopping cart will only temporarily hold the details until the checkout, then they will be amended into the OrderDetails table but they will have a unique OrderNo added to each, so OrderNo, ProdID and CustID instead of just the last 2 in the shopping cart table. What I don't understand is why you have to put all of this in the same table. Quote Link to comment Share on other sites More sharing options...
gluck Posted April 21, 2008 Share Posted April 21, 2008 Not sure what you want to do but it seems all you need is either a temp table that can store CustID, ProductID, NUSDiscount, and OrderQuantity from the ShopCat and the OrderID. Once you are done with the transaction just select the record details from the temp table and insert them into your orders or whatever table and delete the temp entries. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.