Page 1 of 1

Shoe Store Setup

Posted: Fri Jul 23, 2010 12:20 pm
by atanas13
Hello dudes!
First, I want to apologize for my Engrish, it's not my native language.
So, I am working on a webstore for shoes. I am wondering in what way I can setup a MySQL table where the quantity of the different sizes can be stored?
Any tips and instructions are greatly appreciated!
Thanks in advance, The PHP & MySQL newbie.

Re: Shoe Store Setup

Posted: Wed Jul 28, 2010 6:10 pm
by mecha_godzilla
I think you'd probably want to have three tables to do this, one for each distinct product type (products), one for the type of shoe (shoe_type) and another for the size (shoe_size).

Your tables might look like:

products
product_id: 1
product_code: MENS-0001
shoe_type: 1
shoe_size: 1
quantity: 10

shoe_type
shoe_id: 1
shoe_description: Comfortable men's work shoe

shoe_size
size_id: 1
size_description_uk: 8
size_description_us: 9
size_description_europe: 42

To retrieve the values, you'd then need to use JOIN - an example SQL statement (not checked for errors!) might be:

Code: Select all

SELECT products.product_code, shoe_type.shoe_description, shoe_size.size_description_uk
FROM products
JOIN shoe_type ON products.shoe_type = shoe_type.shoe_id
JOIN shoe_size ON products.shoe_size = shoe_size.size_id
WHERE products.quantity > 0
Hope that helps,

Mecha Godzilla