Hi,
I want to make a site which compares prices of a product from different brands.I wanted have something like By Category, By Brand, By Store, Best Deal, Gift Deal.Do I need to create different tables?or is it enough if I create 1 table?Can you please tell me how to start with this kind of site?

Thank You.

you will want to create different tables. one for stores, brands, categories, products.

Table Store: Store_ID, Store_Name, Location.
Table Brand: Brand_ID, Brand_Name.
Table Categories: Cat_ID, Cat_Name.
Table Product: Prod_ID, Brand_ID, Cat_ID, Prod_Name, Price, Details.

you can add other tables like store inventory. this way everything will be seperate but still linked together.

In Categories we have sub-cat,where to store them.For example,I have a category called Books.Under that I have Fiction(20), Comic(30),so on.How to store them?As you said in the above thread, all the Id's should be unique?

In Categories we have sub-cat,where to store them.For example,I have a category called Books.Under that I have Fiction(20), Comic(30),so on.How to store them?As you said in the above thread, all the Id's should be unique?

Table Store: Store_ID, Store_Name, Location.
Table Brand: Brand_ID, Brand_Name.
Table Categories: Cat_ID, Cat_Name.
Table Product: Prod_ID, Brand_ID, Cat_ID, Prod_Name, Price, Details.

In the products table you can something like this:
Product Table:
Prod_ID = 1
Store_ID = 2
Brand_ID = 2
Cat_ID = 1
Prod_Name = Fiction Book Name
Price = $19.99
Details = Book Information

Categories Table:
Cat_ID 1 , 2
Cat_Name Fiction , Non-Fiction

when you want to display this info

$prod = mysql_query(SELECT products. * , brand.Brand_Name, Stores.Store_Name, Categories.Cat_name
FROM products
LEFT JOIN (
brand, stores, categories
) ON ( products.store_id = stores.store_id
AND products.brand_id = brand.brand_id
AND products.cat_id = categories.cat_id ) )  ) or die(mysql_error());
This article has been dead for over six months. Start a new discussion instead.