JimJx has asked for the wisdom of the Perl Monks concerning the following question:
I have a table with several columns, the 2 I am concerned with at the moment are Category and Keywords.
I need to search both of these columns for a word or short phrase that I get from a form.
For example, the search can be 'Antiques' or 'Antique Dealers'
I tried to use this
in several different ways but no joy.SELECT name, address, city, phone FROM valley WHERE keywords LIKE '%$search%' OR category LIKE '%$search%' ORDER BY name LIMIT %d,%d"
When I use that snippet of code, I will get any matches from 'keywords' but nothing from category, even though I know there is a category with the var in it....
I have also tried
This gives me nothing for multiword searches....SELECT name,address,city,phone FROM valley WHERE CONCAT_WS(' ',keywords,category) LIKE '%$search%' ORDER BY name LIMIT %d,%d
Any ideas?
Thanks,
Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search 2 columns
by Corion (Patriarch) on Sep 22, 2007 at 07:02 UTC | |
|
Re: Search 2 columns
by Gangabass (Vicar) on Sep 22, 2007 at 08:29 UTC | |
by JimJx (Beadle) on Sep 22, 2007 at 11:54 UTC | |
by blokhead (Monsignor) on Sep 22, 2007 at 14:53 UTC | |
by roboticus (Chancellor) on Sep 22, 2007 at 16:35 UTC | |
by graff (Chancellor) on Sep 23, 2007 at 15:15 UTC | |
| |
by graff (Chancellor) on Sep 22, 2007 at 15:11 UTC | |
by JimJx (Beadle) on Sep 23, 2007 at 06:01 UTC | |
by andreas1234567 (Vicar) on Sep 23, 2007 at 06:48 UTC | |
by graff (Chancellor) on Sep 23, 2007 at 19:38 UTC |