开发者

mysql fulltext multiple words from one form input?

I've heared alot of similar discussion but I havent seen a direct solution.

SELECT * FROM patient_db WHE开发者_运维知识库RE 
       MATCH ( Name, id_number ) AGAINST ('%$term%' IN BOOLEAN MODE);

Isn't there something simple around my '%$term%' I need to do to enable multiple-word searching?


Unfortunately, there is no way to directly say, "I want one of these n words" in a MySQL fulltext query. Your only real option is

SELECT * FROM patient_db WHERE 
       MATCH ( Name, id_number ) AGAINST ('%$term%' IN BOOLEAN MODE)
       OR MATCH ( Name, id_number ) AGAINST ('%$term2%' IN BOOLEAN MODE)
       OR MATCH ( Name, id_number ) AGAINST ('%$term3%' IN BOOLEAN MODE)
       ;

Just curious, but why are you searching a column named id_number for text?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜