•
•
•
•
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
![]() |
•
•
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation:
Rep Power: 1
Solved Threads: 0
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.
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
•
•
Join Date: Dec 2007
Location: Oklahoma
Posts: 161
Reputation:
Rep Power: 1
Solved Threads: 16
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.
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.
•
•
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation:
Rep Power: 1
Solved Threads: 0
•
•
Join Date: May 2008
Location: Hyderabad,India
Posts: 89
Reputation:
Rep Power: 1
Solved Threads: 0
•
•
Join Date: Dec 2007
Location: Oklahoma
Posts: 161
Reputation:
Rep Power: 1
Solved Threads: 16
•
•
•
•
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
php Syntax (Toggle Plain Text)
$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());
Last edited by ProfessorPC : Jun 4th, 2008 at 10:36 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- substitue of comparison operators (C++)
- Computer Languages Comparison Tutorials (Computer Science and Software Design)
- OS Comparison (Techies' Lounge)
Other Threads in the PHP Forum
- Previous Thread: Simple Login System: Need Advice.
- Next Thread: help with checkbox array - Trim Variable Function getting in the way


Linear Mode