User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,433 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,726 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 228 | Replies: 4
Reply
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation: Suhacini is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Suhacini Suhacini is offline Offline
Junior Poster in Training

Comparison

  #1  
May 30th, 2008
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.
Suhasini
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Location: Oklahoma
Posts: 161
Reputation: ProfessorPC is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 16
ProfessorPC ProfessorPC is offline Offline
Junior Poster

Re: Comparison

  #2  
May 30th, 2008
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.
Reply With Quote  
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation: Suhacini is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Suhacini Suhacini is offline Offline
Junior Poster in Training

Re: Comparison

  #3  
Jun 3rd, 2008
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?
Suhasini
Reply With Quote  
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation: Suhacini is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Suhacini Suhacini is offline Offline
Junior Poster in Training

Re: Comparison

  #4  
Jun 4th, 2008
Someone there to help with this?
Suhasini
Reply With Quote  
Join Date: Dec 2007
Location: Oklahoma
Posts: 161
Reputation: ProfessorPC is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 16
ProfessorPC ProfessorPC is offline Offline
Junior Poster

Re: Comparison

  #5  
Jun 4th, 2008
Originally Posted by Suhacini View Post
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

  1. $prod = mysql_query(SELECT products. * , brand.Brand_Name, Stores.Store_Name, Categories.Cat_name
  2. FROM products
  3. LEFT JOIN (
  4. brand, stores, categories
  5. ) ON ( products.store_id = stores.store_id
  6. AND products.brand_id = brand.brand_id
  7. AND products.cat_id = categories.cat_id ) ) ) or die(mysql_error());
Last edited by ProfessorPC : Jun 4th, 2008 at 10:36 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 2:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC