Re: checkboxes names & values in mySQL (newbie)
| From: | Andrey Sosnitsky | Date: | Fri, 11 Oct 2002 05:01:59 +0000 |
| Subject: | Re: checkboxes names & values in mySQL (newbie) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22335@lists.php.net to get a copy of this message | ||
Hello, John.
You wrote 10 îêòÿáðÿ 2002 ã., 23:40:10:
J> 2 questions:
J> Should I have a unique form name for each checkbox, and store it's
J> boolean value in the database, OR (is it more streamlined) ..
J> To create an array <input type=checkbox name=apps value
J> =myarray[$i]> with the same name but different value for each
J> checkbox.
Yes, you are right. This is a good way, to create an array.
J> Finally, how do I construct the query to store the array of values?
J> Do I need a separate column (enum('n','y') for each value, or
J> should I store all the true values as a long text string?
It'll be nice to store values separetly each in row.
Smth like this
INSERT INTO table (apps, value) VALUES ('apps', '$value[1]');
INSERT INTO table (apps, value) VALUES ('apps', '$value[2]');
etc.
Then, you can manupulate those values as you want.
www.pskov.ru webmaster|programmer|DBA
www.invest.pskov.ru
www.education.pskov.ru
--
Best Regards,
Andrey mailto:andrey@pleskov.ru