Re: Multiple fields with multiple search items On May 5, 6:33 am, Justin Voelker <justin.voel...@gmail.com> wrote:
> Hello everyone: I am having a bit of a problem trying to wrap my head
> around a particular select statement... I have a table that has
> numerous stores. Beyond the normal address, city, state, zip fields,
> each store record has 5 fields, 1 for each for ice cream flavor
> carried at that particular store. I have a search box that lets you
> search for ice cream flavors. Right now searching for one flavor is
> hard enough since my select statement select all records "where
> flavor1 = "x" or flavor2 = 'x' or...", but I would like the ability to
> search for multiple flavors, and have the returned results start with
> those stores that match the most flavors searched upon. Does anyone
> have any way of doing this? Also, the page is written in PHP so if
> you have any php related way to handle this issue, I am more than
> happy to try them as well. Thank you!!!
Normalize your data. Don't use 5 fields. Use a separate table instead
e.g. store_flavors(store_id*,flavor_id*) |