You are here: Multiple Select Field « PHP « IT news, forums, messages
Multiple Select Field

Posted by Robb Kerr on 10/15/16 11:12

Please excuse the length and complexity of this post. I am facing a
complicated problem and need to find a solution. Also, I have posted this
on both PHP and MySQL boards so please overlook the possibly slightly
off-topic subject.

I have got one table that contains personal information about users.
Another table consists of a list of many interests. This table is composed
of simply 2 fields – an ID and the interest. (see below)

I can build an HTML form which includes a multiple select list out of which
the user can select their interests. I have the list configured so that it
displays the “interest” while the value stored is the “ID”. PHP stores this
entry as an Array which I can easily turn into a comma delimited list
before storing in the database.

Here’s my problem. If I store a comma-delimited list in a text field in the
Users table, how do I query to determine anyone that has selected specific
interests? If I use a full-text search and someone selects “1” for their
search criteria, the query will return anyone who selects 1, 10, 11, 12,
13, 14, etc. as their interest.

This problem has surely occurred for others. It would affect how you store
newsletters for which one might subscribe, keywords in a clipart system,
interests the user has, anything from which you want your users to select
multiple entries from a long list of choices.

Table = Interests
Fields = ID, int, auto-increment
Interests, text

Table = Users
Fields = ID, int, auto-increment
Name, text
Address, text
Interests, text

Thanx in advance for any help you might provide. If anyone knows of
anything written on configuring this type of system, please include a link.

Robb
Digital IGUANA

 

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

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