Hmm to do a search on one table it might actually be quicker to do a query
for every thing in the query.  First convert to all lowercase.  Then explode
the query into an array using " " as the delimiter.  Then implode this array
into a list that looks something like this.  "var1","var2"...)  you can do
this by using implode and putting Quotes at the end.  Then in the query you
can use the IN part of the query.  I'm sorry if this is totally incorrect
but I'm going off my memory.  SELECT fields FROM tbl
                                    WHERE tblFields IN ($query)  it might be
INTO but I'm dang sure it is IN.  Go to and for some
good resources on search engines you can modify it to suit your needs.  I
this helps a little bit.

----- Original Message -----
From: "Chris Payne" <[EMAIL PROTECTED]>
Sent: Saturday, March 30, 2002 7:15 PM
Subject: [PHP-DB] Database search question

Hi there everyone,

How can I accomplish the following?

I have a table called search,

I have 3 fields, city, country, type

I also have an imput box where you can type in a search word.  What I need
is, say you type in hotels germany, I need the search to break up the
sentence and then search each 3 fields in the DB looking for a match.

So, for example: it would find hotels in type and germany in country, see
that they belong together and then display those results - how can I do

I know I need to splitup my search phrase into individual words to search,
but i'm stuck.

Thanks for any help.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to