|
Posted by Jerry Stuckle on 04/02/07 12:04
Bob Bedford wrote:
> Hi all,
>
> don't know if I must ask in a mysql NG, but this seems more a php question.
>
> I've to provide a group of items the user may select or not (checkboxes).
> The user may choose from 0 to 35 choices and can select more than 1 choice
> at a time. (multiselect possible).
>
> How to store and retrieve on a mysql field ? how to automate this ? must I
> put in an array, how to build the query ?
>
> Thanks for help.
>
> Bob
>
>
>
Bob,
You're looking at a many-to-many relationship here - you have more than
one user, and more than one checkbox.
Database normalization rules (a good thing to look up) show that you
need a separate table to hold the relationship.
So you would have a table with the user information, a table for the
checkbox descriptions (unless they would never, in a million years,
change) and a third table with entries for a userid and a selected checkbox.
Probably the easiest way is to get the data from the HTML code as an
array and insert each element into the table.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|