Shiloh Madsen wrote:

say someone enters a search string of  "cat dog mouse rabbit" (without the
qoutes) into my search box. What I need for the results page to do is to
construct a query that will search through my keywords table for every
instance of ANY of those words. How would you suggest I handle this?

For that simple example, you can just explode the string on the space and create a WHERE clause entry for each word.

For example:

$words = explode(' ',$_GET['search_text']);
foreach($words as $word)
{ $query .= " AND column LIKE '%$word%' "; }

Gets more complicated the more you want to parse the search text and is dependant upon what database you're using.

---John Holmes...

Amazon Wishlist:

php|architect: The Magazine for PHP Professionals –

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to