Re: Multiple word queries
| From: | Randy C Boland | Date: | Thu, 01 Jul 2004 03:50:08 +0000 |
| Subject: | Re: Multiple word queries | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35075@lists.php.net to get a copy of this message | ||
By Shiloh's description, I think you want to replace AND with OR -
using AND will only return rows that contains every word, while using
OR will match any row that has any of them.
On Wed, 30 Jun 2004 23:22:04 -0400, John W. Holmes
<holmes072000@charter.net> wrote:
> 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%' "; }