![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I am working on using php and mysql to create dynamic web pages and I am working on planning my database structure. The issue I have is how to structure the tables for various product attributes I have (i.e. sizes, colors). These will vary as some products have 2 sizes and others may have 7, some products may have 1 color and others may have 8. First, I planned on having separate tables for the sizes and the colors. How should I structure these tables? Does the following make sense? ProdID Size1 Size2 Size3 ........ Size 8 Shirt S M L XXL Now for many products Size 4 - Size 8 may be empty. Is structuring a table with so many empty fields a problem? Or should I structure the table as follows: ProdID S M L ........ XXL Shirt Y Y N N With colors I have probably 12 or so total, but very few products use more than 3-4, and a couple of colors are only used on 1-2 products. Any advice appreciated. Rob aka Johnny | |||
|
| | #2 | ||
| "Tom Thackrey" <tomnr@creative-light.com> wrote in message news:wOpOa.239$TO.25054403@newssvr14.news.prodigy. com... > > On 7-Jul-2003, "Johnny Bagadonuts" <rob_robster-AT-hotmail.com> wrote: > > > I am working on using php and mysql to create dynamic web pages and I am > > working on planning my database structure. The issue I have is how to > > structure the tables for various product attributes I have (i.e. sizes, > > colors). These will vary as some products have 2 sizes and others may > > have > > 7, some products may have 1 color and others may have 8. > > > > First, I planned on having separate tables for the sizes and the colors. > > How should I structure these tables? Does the following make sense? > > > > ProdID Size1 Size2 Size3 ........ Size 8 > > Shirt S M L XXL > > > > Now for many products Size 4 - Size 8 may be empty. Is structuring a > > table > > with so many empty fields a problem? Or should I structure the table as > > follows: > > > > ProdID S M L ........ XXL > > Shirt Y Y N N > > > > With colors I have probably 12 or so total, but very few products use more > > than 3-4, and a couple of colors are only used on 1-2 products. > > > > Any advice appreciated. > > Database normalization is a pretty big topic. There are lots of tradeoffs > between speed and flexibility. Here's a place to start: > > http://www.devshed.com/Server_Side/M...al1/page1.html > > -- > Tom Thackrey > www.creative-light.com At first glance looks like a decent site. Thanks - I'll check it out in detail. | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: database, mysql, php, structure |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Working with MySQL database from C/C++ | TreatmentPlant | Database | 0 | 06-26-2007 12:08 AM |
| Connecting to MySQL database | Marco | Database | 0 | 06-26-2007 12:08 AM |
| Connecting to MySQL database | Marco | Database | 0 | 06-26-2007 12:08 AM |
| cannot move the mysql database to a new server | Simon Lee | Database | 1 | 06-10-2007 12:21 AM |
| Dumping MySQl Database | Capn' Crunch | Database | 2 | 05-31-2007 8:41 PM |
| Featured Websites | ||||
|