Vegetables table
Unique_Id | Vegetable
------------------------------------------------------------
1 | avacados
------------------------------------------------------------
2 | onions
------------------------------------------------------------
3 | lemons
------------------------------------------------------------
4 | greenbellpeppers
Months table
Unique_Id | Months
------------------------------------------------------------
1 | jan
------------------------------------------------------------
2 | feb
------------------------------------------------------------
3 | mar
------------------------------------------------------------
4 | apr
------------------------------------------------------------
5 | may
------------------------------------------------------------
6 | june
------------------------------------------------------------
7 | july
------------------------------------------------------------
8 | aug
------------------------------------------------------------
9 | sept
------------------------------------------------------------
10 | oct
------------------------------------------------------------
11 | nov
------------------------------------------------------------
12 | dec
Vegetable_Month table
Unique_Id | Veg_Id | Month_Id
------------------------------------------------------------
1 | 1 | 6
------------------------------------------------------------
2 | 1 | 7
------------------------------------------------------------
3 | 1 | 8
------------------------------------------------------------
4 | 2 | 4
------------------------------------------------------------
5 | 2 | 5
------------------------------------------------------------
6 | 3 | 5
------------------------------------------------------------
7 | 3 | 6
------------------------------------------------------------
8 | 4 | 6
One table has all the vegetables names the other has all the a months and the last ties them both together This is handy if you realize that, for example onions, need to be in june also you simply add another row to the Vegetable_Month table
[CODE]
9 | 2 | 6
[/CODE]
Or a better example might be if you suddenly need to have the the fully qualified names or the month number for each month
Unique_Id | Month | Name | Number
------------------------------------------------------------
1 | jan | January | 01
------------------------------------------------------------
2 | feb | February | 02
------------------------------------------------------------
3 | mar | March | 03
------------------------------------------------------------
4 | apr | April | 04
------------------------------------------------------------
5 | may | May | 05
------------------------------------------------------------
6 | june | June | 06
------------------------------------------------------------
7 | july | July | 07
------------------------------------------------------------
8 | aug | August | 08
------------------------------------------------------------
9 | sept | September | 09
------------------------------------------------------------
10 | oct | October | 10
------------------------------------------------------------
11 | nov | November | 11
------------------------------------------------------------
12 | dec | December | 12
You then just have to change the 12 records in the Month table verse the hundreds that could be in the Vegetable_Month table.
And if your php is setup correctly the change has no effect on your existing code. But you can easily change any place that you need to use the new info.
The idea allows for maximum flexibility. Many web designers run into trouble when the site they made has grown a lot and then need to add new features and/or data storage and handling. And because of how they originally set everything up they are forced to basically start over.
The idea we are suggesting is to start out on the right foot. It may seem quite odd if you have not done a lot of database work but believe me years form now you maybe very ecstatic that you set it up this way.