Re: Question about a data structure
- From: Arjen <dont@xxxxxxx>
- Date: Mon, 29 Jan 2007 13:58:07 +0100
Larry in Honolulu schreef:
I'm helping a friend with a website (aren't we all) that will have a long questionnaire. There will be about 150 data items, all of which will be chosen from radio buttons with four choices each. I'll store the resulting data in a MySQL data table, and I'm thinking I don't want 150 fields there. Since all the responses can be coded as 1-4 (or 0-3), I'm thinking of storing them in groups, with the values just strung together, and later decoded. i.e. 12132 24331 31142 etc. That would reduce the number of fields to a more manageable size.
What I'm really wondering is, where's the tradeoff? If I store it as a string, it could just be a simgle 150 character string. If stored as numeric (seems more efficient) then I'd have to keep the max values in line with the numeric type.
The data will eventually be used as numbers, but php can pretty easily convert between so that doesn't seem to me to be an issue?
Any suggestions?
I once had a lot of trouwble storing floats as a varchar (it had it's reasons -> preexisting structure and not much time). I had to strip them digit by digit and then add them up again for php to recognize them as floats. Declaring them as float had no effect whatsoever.
Why dont u save yourself lotsa trouble and do it right (and keep ur script flexible). If you have 150 awnsers store them in 150 fields. If you have an unkown amount of awnsers per user store them in a relative database.
Only if performance is a big issue you might want to reconsider.
--
Arjen
http://www.hondenpage.com
.
- Follow-Ups:
- Re: Question about a data structure
- From: asdf
- Re: Question about a data structure
- References:
- Question about a data structure
- From: Larry in Honolulu
- Question about a data structure
- Prev by Date: Get error when I add new theme & select it in setting. Error shuts down postnuke
- Next by Date: Re: Question about a data structure
- Previous by thread: Question about a data structure
- Next by thread: Re: Question about a data structure
- Index(es):