Date: 10/15/01
- Next message: peterdove7846 <email protected>: "[PHP] A Way to avoid enforced time-outs"
- Previous message: Rudolf Visagie: "RE: [PHP] Switch syntax"
- In reply to: _lallous: "[PHP] Re: how to do a search in mysql database for multiple keywords??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Another solution would also be to use the FULLTEXT functions availble in
MySQL... it is by far faster than this query. To do so, your fields must be
of type VARCHAR and TEXT. Then create a FULLTEXT index on these fields by
issuing the following command:
ALTER TABLE <tablename> ADD FULLTEXT(<column1>,<column2>,<ccolumn3>)
Then your query would look like:
SELECT *, MATCH(<field1>,<field2>,<field3> ) AGAINST ('$qiery' ) AS score
FROM Messages WHERE MATCH( <field1>,<field2>,<field3> ) AGAINST ( '$query'
) ORDER BY score DESC;
This would return the results in order of relevance... works pretty good :)
-- ------------------------------------------------------------------------ James "Mike" Patton \ Professional web applications developer mpatton <email protected> \ Specializing in PERL, MySQL, PHP and JAVA ------------------------------------------------------------------------On 2001.10.15 03:42 _lallous wrote: > describe your question more... > anyway: > > SELECT thetext FROM thetable WHERE > (INSTR(thetext, 'keyword1') <> 0) OR > (INSTR(thetext, 'keyword2') <> 0) OR > (INSTR(thetext, 'keyword3') <> 0); > > this will search for either of the three keywords... > > "Nicklas Bondesson" <nicke <email protected>> wrote in message > news:20011013133802.49776.qmail <email protected> > > need some help on this. i've come so far that i have split up the > variable > > with explode and putting it into an array that looks like this: > > 'keyword1','keyword2'. > > > > but it doesn't doesn't work satisfactory... > > > > any ideas?? > > > > /nicke > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe <email protected> > For additional commands, e-mail: php-general-help <email protected> > To contact the list administrators, e-mail: php-list-admin <email protected> >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: peterdove7846 <email protected>: "[PHP] A Way to avoid enforced time-outs"
- Previous message: Rudolf Visagie: "RE: [PHP] Switch syntax"
- In reply to: _lallous: "[PHP] Re: how to do a search in mysql database for multiple keywords??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

