Jump to content

Amend Table query question


psychowolvesbane

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.