Parsing a phrase

From: Date: Sun, 12 Dec 2010 19:40:05 +0000
Subject: Parsing a phrase
Groups: php.general 
Request: Send a blank email to php-general+get-309991@lists.php.net to get a copy of this message
Hello all. I have a page where the user can enter a search phrase and upon submitting, the search phrase is queried in MySQL. However, I need to modify is so each word in the phrase is searched for... not just the exact phrase. So, "big blue hat" will return results like: "A big hat - blue in color" "Hat - blue, big" SQL would look like .... WHERE (item_description like "%big%" and item_description like "%blue%" and item_description like "%hat%" ) So, via PHP, what is the best way to extract each word from the search phrase to it's own variable so I can place them dynamically into the SQL statement. Thanks, --Rick

« previous php.general (#309991) next »