You are here: Re: many choices « PHP Programming Language « IT news, forums, messages
Re: many choices

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]


Удаленная работа для программистов  •  Как заработать на 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

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