maziagha Posted September 11, 2006 Share Posted September 11, 2006 Hi!I'm working on a webshop and everything works fine. Now there is only one thing left and i can't get it working.In the code below i'm Updating the products the customer is buying into the Quantity table(works good) but at the same time i want to remove the quantity of the product from the stock list that contains sizes of the products. Here is the part that I updatethe products in quantity table:[code]for ($i = 0; $i < $numItem; $i++) {$sql = "UPDATE tbl_product SET pd_qty = pd_qty - {$cartContent[$i]['ct_qty']}WHERE pd_id = {$cartContent[$i]['pd_id']}";$result = dbQuery($sql);[/code]Here is the code to remove the specific sizes from the stock:[code]$query = "UPDATE productquantity SET Quantity = Quantity - {$cartContent[$i]['ct_qty']}WHERE QProdID = {$cartContent[$i]['pd_id']} AND QSizeID = {$cartContent[$i]['ct_size_n']}";[/code]So it should look like this:[code] for ($i = 0; $i < $numItem; $i++) {$sql = "UPDATE tbl_product SET pd_qty = pd_qty - {$cartContent[$i]['ct_qty']}WHERE pd_id = {$cartContent[$i]['pd_id']}";$query = "UPDATE productquantity SET Quantity = Quantity - {$cartContent[$i]['ct_qty']}WHERE QProdID = {$cartContent[$i]['pd_id']} AND QSizeID = {$cartContent[$i]['ct_size_n']}";$result = dbQuery($sql,$query);[/code]But this wont work. Can anyone pls help me??? Link to comment https://forums.phpfreaks.com/topic/20374-insert-into-one-table-and-update-another-one/ Share on other sites More sharing options...
fenway Posted September 11, 2006 Share Posted September 11, 2006 What is it that's not working about it? Link to comment https://forums.phpfreaks.com/topic/20374-insert-into-one-table-and-update-another-one/#findComment-89797 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.