castis Posted April 18, 2007 Share Posted April 18, 2007 This isnt going to be any ecommerce action here. This is just an application for me to keep track of items we have available for my band. As of right now I have two tables: `items` and `variants` `items` consists of: `id`, `name`, and `color. `variants` consists of: `id`, `variant_of`, `size`, `price`, and `in_stock` Then I have this query to get everything out. $query = "SELECT * FROM `items` AS i LEFT JOIN `variants` AS v ON v.variant_of = i.id ORDER BY i.id ASC"; Everything is working according to plan up to this point. And then I realized I have absolutely no idea how to display the information the way I want it. I have one entry in `item` which is: id: 1 name: Unisex Cotton Tee color: black and two entries in `variants` which are: id: 1 variant_of: 1 size: SM price: 10.00 in_stock: 13 and id: 2 variant_of: 1 size: MD price: 10.00 in_stock: 13 Just to give me a place holder. Now I'd like for it to display one item, but have a dropdown form to select the size. And thats where I lost it. Any ideas? EDIT: I thought about putting another loop inside while($row = mysql_fetch_assoc($results)) to go through and add sizes to a class and then when the item id changes, display the item... You think that'll work? Link to comment https://forums.phpfreaks.com/topic/47640-phpmysql-apparel-database-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.