samoht Posted October 12, 2007 Share Posted October 12, 2007 hello, I am trying to set up a function to recalculate prices for my products - (per product that is) The problem I am having is that I have a table that stores the prices for each client type (so one product can have multiple prices) so I need to be able to recalculate the price for each client. Here is my db set up: tables: productprice ProductPriceId pk ProductId fk to product ClientPriceCode PriceRetail PriceSell Cost pricecodeprice pcpId pk PriceCodeId fk to pricecode ClientPriceCode RetailFactor SellFactor CostFactor (not neccesary) When I come into my function I pass the values of ProductId, PriceCodeId, and Cost. Based on these three known variables I then <?php //grab all the client types to recalculate prices for. $q = dbQuery("SELECT ClientPriceCode FROM productprice WHERE ProductId ='$ProductId'"); $nClients = mysql_num_rows($q); now I need to get the factors from pricecodeprice - but I will have multiple clients so how do I get the factors from the pricecodeprice table?? <?php // get the factors for each client type from pricecodeprice. $q = dbQuery("SELECT RetailFactor FROM pricecodeprice WHERE ??"); perhaps I should use a for loop? for(i=0; i<$nClients; i++) { then grab the factors inside the loop. But how do I store the factors to be able to do the math on them? Link to comment https://forums.phpfreaks.com/topic/72939-retrieve-data-from-table-with-multiple-returned-variable/ Share on other sites More sharing options...
samoht Posted October 12, 2007 Author Share Posted October 12, 2007 Any Ideas?? Link to comment https://forums.phpfreaks.com/topic/72939-retrieve-data-from-table-with-multiple-returned-variable/#findComment-368122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.