NikkiLoveGod Posted November 13, 2008 Share Posted November 13, 2008 Hi! I was wondering how should I design my database and how to collect info from there in a right way. So I have few products, lets say I have Tiles Y, and there is yellow tile Y, blue yellow tile Y and so on, then there is Tiles X, and there is green tile X, pink tile X. How should I design my database to hold this information? And I need to be able to list all of these products as a single product, like separate colors from each others, and then in another view, I have to combine Tile Y's colors, to show just one product. I am thinkin of putting it into a single product table, where you have the Name, ID, and Color there. And then you would somehow loop through it by doing "loop products and show each as its own product" and then you would have another loop on another view, where you would do "loop products, combine colors into one product". Any pointers? And how would I go about getting and combining the data like that? Thanks alot! Hope you guys dont start to feel like I am making you design my work, I just need one "best practice" and I can come up solutions by that on my own. hehe. -NikkiLoveGod Quote Link to comment https://forums.phpfreaks.com/topic/132602-database-design-products-with-different-colors/ Share on other sites More sharing options...
corbin Posted November 13, 2008 Share Posted November 13, 2008 Look into database normalization. It's your friend. You would essentially want to store all of the products in one table. Then, you would want to store all of the options (color, size, what ever) in another table. Quote Link to comment https://forums.phpfreaks.com/topic/132602-database-design-products-with-different-colors/#findComment-689790 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.