You are here: Re: Question about a data structure « All PHP « IT news, forums, messages
Re: Question about a data structure

Posted by Tom on 01/30/07 20:18

On Mon, 29 Jan 2007 09:46:08 GMT, Larry in Honolulu wrote...
>
>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?
>
>Thanks much,
>Larry L [in Honolulu]


A SQL database is meant to store data so it's probably worth keeping the
information in a clean format so PHP, Perl, or other languages can access and
make use of the information. If you store them individually you can define the
values as integers, rather than rigging a text string that has to be manipulated
later. I'd rather have SQL do the work for me, and simply add, edit, or delete
the information. It would seem like more work in the long run to work with a
string of numbers, than setting up the table columns once and creating a
function to add or update the table.

Tom
--
Newsguy Express 30 GB / month $9.95
http://www.newsguy.com/overview.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация