View Single Post

   
  #5 (permalink)  
Old 02-28-2008, 10:27 AM
Lars Eighner
 
Posts: n/a
Default Re: Data from 2 columns

In our last episode,
<1190316521.493308.312510@k79g2000hse.googlegroups .com>,
the lovely and talented JimJx
broadcast on comp.databases.mysql:

> Hi all,
> I have what I hope is a simple 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


> SELECT name, address, city, phone
> FROM valley
> WHERE keywords OR category


You can't do that. OR only works with expressions. This isn't English, in
which you can 'or' subjects or predicates.

> LIKE '%$search%'
> ORDER BY name LIMIT %d,%d"


> in several different ways but no joy.


> 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....


> Example:
> If the form passes 'auto' and I have an entry in keywords for 'auto
> dealers' and a category for 'auto repair', I will get the auto
> dealers, but not the auto repair.....


> Any ideas?


> Thanks,
> Jim


--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 487 days to go.
What do you do when you're debranded?
Reply With Quote