Re: keyword search syntax
| From: | David Otton | Date: | Tue, 28 Oct 2003 02:09:06 +0000 |
| Subject: | Re: keyword search syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167823@lists.php.net to get a copy of this message | ||
On Mon, 27 Oct 2003 20:00:24 -0600, you wrote:
>I've got a field in my database that contains keywords about the particular
>record. I've got a form with a text entry field for visitors to enter
>keywords for which they would like to find records whose keyword field
>contains the words they entered. The submission form assigns the keywords
>entered to a variable which is passed via GET to the results page. What is
>the syntax for generating this query. I tried the following but it doesn't
>work...
>
>WHERE field CONTAINS $variableContainingKeywordEntry
Personally, I'd normalize that into a keyword table, a record table and a
joining table.
However, the SQL keyword you're looking for is LIKE
WHERE field LIKE '%$variable%'