View Full Version : help with database field?

02-19-2007, 01:10 PM

I have a form which I am trying to get online, basically if the volunteer wants to join up, they select the time scales they are available?

the options are:

Sat, Sun, Mon, Tue, Wed, Thu, Fri,

and options are: morn, after, eves...

what would be the best way to use only one field but enter the info and then pull it out.. will only be ticks

I did think something like 1=mon, 2= tue etc... and the M=morn, A=afternoon, E=Evening...

so the field could look like 1M1A2M3E would mean monday morning and afternoon, tuesday morning, and then wed evening..

but I dont know how to create this to look at the letters etc..

any other ideas

(the other option is 21 fields ie - Sat Morning = YES/No etc etc... but then becomes a mad database...

02-20-2007, 08:39 AM
First of all keeping multiple values into a single field violates the principle of RDBMS.

I wonder why you are going for a single field to store two different type of data. I mean the day(mon,tue,wed....) and the time (morn, after & eves)

You need a simple table with the following configuration.

1. A userId using which you can identify the user. This must be unique

2. You can store whatever other information like his/her name, address, etc in the table.

3. You have a field to store the day preference of the user

4. You have another field to store the time preference of the user.

This method looks lengthy but whenever you need to take the details about the user you don't have to manipulate the values much.

You can also divide data into a number of tables and relate them using RDBMS techniques but before mentioning that It is better you check your requirement once more.