...

View Full Version : Check Boxes?



EthanX
07-28-2002, 02:28 AM
Hello, can I put checked boxes all in the same feild in MySQL?
and then beable to get them back as varables?

Spookster
07-28-2002, 05:15 AM
Do you mean check boxes or radio buttons?

EthanX
07-28-2002, 05:16 AM
Check boxes......

Spookster
07-28-2002, 05:26 AM
Well since checkboxes have different values you would have to concantenate all the values together using some kind of distinguishing separating character. Then to retrieve them you would have to split the string back up based on the seperator used. Why would you want to put multiple values into one field?

EthanX
07-28-2002, 05:28 AM
Well, if I make a table structure; can I add a new field to it?

Spookster
07-28-2002, 05:31 AM
If this is going to be a relational database then you simply need to normalize the database.

EthanX
07-28-2002, 05:31 AM
huh?

Spookster
07-28-2002, 05:39 AM
It sounds like you have a multivalued attribute situation. That just means you have a situation where you have an indefinite number of values that will go with a particular record. I'll try and not use to much db lingo. I do this for a living. lol

For example lets say you have a table that you wanted to store personal info on an employee. Lets say you wanted to list that employees family members. Well not every employee would have the same number of family members so logically they could not be columns in the same table as the employee info. In this case you would list them in another table and link the tables together based off of some unique field in the employee table such as their employee id or SSN.

EthanX
07-28-2002, 06:02 AM
Well I know how to do it with each check box it's own field, but once I make all the fields, can I make a new field if I add a new check box?

Spookster
07-28-2002, 06:05 AM
You really don't need to add columns to a table. That is one of the purposes of creating a relational database. In your case you would use another table and just add records for each checkbox value. Those values would be related to a certain record in the other table.

EthanX
07-28-2002, 07:34 AM
Show some code please.

Spookster
07-28-2002, 08:32 AM
There's no code for this. This is just basic concepts of database design.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum