Jump to content

[SOLVED] Searching 2 columns on the same table for the same search terms


Submerged

Recommended Posts

It seems like this would be a common question, but searching through the forums hasn't turned up exactly what I'm looking for.  Basically, I have a table names "sites", and 2 of the columns in there are named "name", and "description".  I then have a query to search for a specific term.

I have the query itself down just fine, when I'm just searching the "name" column:

[code=php:0]SELECT * FROM sites WHERE name LIKE '%$term[0]%' AND name LIKE '%$term[1]%' AND category IN ('1','2','3','4','5','6','7','8','9')[/code]


Which works just fine, but I also need to it to search through the "description" category in the same way as the "name" one (which includes the neccesary "category IN" part).

I'm relatievly new to MYSQL, so I'm not sure how to process the syntax in that, but if someone could give me a hand it would be really great :)

-Alex

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.