stig1 Posted September 1, 2008 Share Posted September 1, 2008 Hopefully someone might be able to point me in the right direction here as I am very confused on the best method to solve my problem. I can get the data out of mysql without a problem. I require one of the following tables to display on the website depending on the data that comes from my table. This is how I would like to see the tables on the website. Example tables below: Price Table 1: Item Code Description Qty Roll Price Bulk Buy Bulk Price Pallet Price Pallet Buy QTY 73524 #735 Polytape 24mm x 75m CLEAR 144 99.99 720 99.99 6912 99.99 [/td] Price Table 2: Item Code Description Qty Roll Price Bulk Buy Bulk Price QTY 73524 #735 Polytape 24mm x 75m CLEAR 144 99.99 720 99.99 Price Table 3: Item Code Description Price Each QTY 38000 Pistol Grip 50mm 99.99 The part I am having trouble with is thinking of the best method to create these, as some items do not have all the information. For example. Item Code Description Qty Roll Price Bulk Buy Bulk Price Pallet Price Pallet Buy QTY 73524 #735 Polytape 24mm x 75m CLEAR 144 99.99 720 99.99 6912 99.99 73536 #735 Polytape 36mm x 75m CLEAR 144 99.99 720 99.99 What I would like to know is what function I could run through the records in the database to decide what price table to use. For example if there is only 1 qty in the qty field.. use price table 3.. if there 2 qty fields with data use price table 2.. else use price table 1. However you could have the data like below: Item Code Description Qty Roll Price Bulk Buy Bulk Price Pallet Price Pallet Buy QTY 73524 #735 Polytape 24mm x 75m CLEAR 144 99.99 720 99.99 73536 #735 Polytape 36mm x 75m CLEAR 144 99.99 720 99.99 6912 99.99 [td] That would only pick up a two qty table to display. How can you check all records in the database and then decide on the price table best suited. Hopefully someone would be able to point me in the right direction! Thankyou Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/ Share on other sites More sharing options...
stig1 Posted September 4, 2008 Author Share Posted September 4, 2008 Anyone got any ideas? hints? Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-633413 Share on other sites More sharing options...
stig1 Posted September 4, 2008 Author Share Posted September 4, 2008 I was thinking if i can run a script that goes through all the records first for that particular product, and if there one record with 3 breaks use that price table.. So confused.... Here is a couple of sample links... to show people what I am trying to achieve, however they do it using .net Price Table 1 http://www.signet.net.au/Catalogue/browse.aspx?sid=580 Price Table 2 http://www.signet.net.au/Catalogue/browse.aspx?sid=596 Price Table 3 http://www.signet.net.au/Catalogue/browse.aspx?sid=584 Hopefully someone will be able to help me out Not asking for the code.. just a helpful idea! Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-633419 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 Well, you can just have one table with all the fields and if any are empty, just check for them and not display them. Simple as that. You can set the table's columns to a default value of " ". That way, the table display won't look weird. And you can use SQL to select results by quantity. Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-633423 Share on other sites More sharing options...
stig1 Posted September 4, 2008 Author Share Posted September 4, 2008 Hey Ken2k7, I just updated the post with some links. The data is stored all in one mysql table. I can pull the data out no problem. For example: Price Table 1 http://www.ozebuy.com.au/~new/browse.php?c=1&csID=2 Price Table 2 http://www.ozebuy.com.au/~new/browse.php?c=1&csID=21 Price Table 3 http://www.ozebuy.com.au/~new/browse.php?c=1&csID=1 But i want to be able to create the above tables via html depending on the data requirements. Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-633425 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 Yeah so what's the hard part? Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-633430 Share on other sites More sharing options...
stig1 Posted September 4, 2008 Author Share Posted September 4, 2008 Knowing which html table to put the data into. Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-634085 Share on other sites More sharing options...
stig1 Posted September 4, 2008 Author Share Posted September 4, 2008 I am actually thinking, of running a script that will do the following.... loop through all the records related to the product group, if pallet buy has a qty use table with 3 columns. if not, loop through all the records related to the product group, if bulk buy exists use tabe with only bulk buy, so i do not show pallet... if only qty exists and the other columns are empty use price each table. would that possible work? it would mean 3 loops and then extract the data into the tables to display... Link to comment https://forums.phpfreaks.com/topic/122300-confusedbest-method-to-solve-this-problem/#findComment-634113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.