Hi,
I have table "products" which contains all items we carry. Some of these items are an accessories to other items. What I used to have is a different table called "products_to_acc" where i would have 2 fields "pid" and "aid" which are basically the ids of items from the same table "products".
Getting this would not be easy, as I have to use "JOIN" to select the actual product info from the "products" table.
This would also take up a lot of space, when you have 1000 items and 9-10 accessories for most of them.
Another way that I tried, is creating a column "acc" in the products table and write the ids of accessories to that field like an array "1,55,236,582,25". These saves space and makes a difference in query as i can "SELECT * FROM products WHERE pid IN (implode(',', $acc))".
Which way would you say is better and what are the benefits of one or the other way? Any other possible solutions to creating this?
Working With: PHP, MySQL
Thank You
Paul B.