Page 1 of 1

Splitting up url parameters for a search.

Posted: Mon May 09, 2005 10:25 am
by eromein
Hi,

I'm creating a search function. When a search on two words (foo bar) I want to find ever record containing foo OR bar.

How do I split up my url (...keyword=foo+bar...) to create a good mySQL query the best way?

Kind regards,

Emiel Romein
Netherlands, the

Posted: Mon May 09, 2005 10:38 am
by anjanesh
$Keywords = explode (" ",$searchString);
Traverse through the array and create a single SQL statement that adds
LIKE %'.$Keywords[$i].'% AND
to the SQL statement.