Don't forget the "in boolean mode" part. It will work a lot better:

SELECT * FROM $table WHERE MATCH (field1,field2,field3,field4) AGAINST ('red lion' IN 
BOOLEAN MODE);

http://www.mysql.com/doc/en/Fulltext_Search.html

Need more code? let me know. I've fallen in love with what in boolean mode has done 
for our search engine. I just wish RedHat and MySQL would get together to upgrade the 
rpms. MySQL 4 has been out for a long time, but only a very early version of MySQL 
4.0.?? is available, unless you know lots about re-installing everything to get 
everything else to work. All it takes is one little old rpm to set things straight. 
Apprently there is some stupd licencing thing going on.

John

"Larry E . Ullman" wrote:

> > I need to create a feature that allows users to enter certain words
> > that can
> > be searched ie
> > search = 'red lion'
> > this would return all data found with the words red and lion.
>
> If you're using MySQL 4.0, you can take advantage of its FULL TEXT
> searching (it's actually available in earlier versions but much better
> in MySQL 4). See the MySQL manual for more information.
>
> Otherwise, you'll need to parse the search box data to break it up into
> individual words, then create a query like...
>
> WHERE column LIKE '%$var1%' AND column LIKE '%var2%%'...
>
> This will be slow, so make sure your database uses indexes.
>
> Again, see the MySQL manual for more.
>
> Larry

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to