php - SQL search for phrases in database aganst body of text -


using php + mysql, have database table containing small phrases like;

+----+-----------------+ | id | phrase          | +----+-----------------+ | 1  | quick brown fox | | 2  | slow green      | | 3  | lazy dog        | | 4  | ultra hyper cat | +----+-----------------+ 

is there practical , efficient way query database small body of text such like...

the quick brown fox jumped on lazy dog

and have return rows 1 , 3? note; text in table consistently formatted no punctuation, single spaces, etc.

thank you.

you looking full text search

select phrase my_tbl match( phrase ) against ('the quick brown fox jumped on lazy dog') 

http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html


Comments