[thelist] MYSQL - select from column
rudy
r937 at interlog.com
Fri Dec 14 23:12:01 CST 2001
>I have a table that has numerous columns. One of which is called
>"docCategories". People can enter up to 4 categories into the column.
hi adrian
4 entries in a column? [gasp]
but.. [splutter] but... that's not normal, man!!
;o)
okay, it's not exactly wrong, but if you ever want to do anything with
product categories other than search for products that belong to a certain
category, then give me a call, and i'll show you how to normalize that data
anyhow, about your question, your sql was like this --
WHERE ... docCat= '" . sqlEncode($form{'CATEGORY'}) . "'
what you need to do is put percent signs (mysql's wildcard search
character)around the form field, and use the LIKE keyword
WHERE ... docCat LIKE '%" . sqlEncode($form{'CATEGORY'}) . "%'
rudy
More information about the thelist
mailing list