前端之家收集整理的这篇文章主要介绍了
php – mysql FULLTEXT搜索多个单词,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我从来没有听过这个直接的答案,我只需要FULLTEXT
搜索几个字,多个字“Firstname Lastname”
$sql = MysqL_query("SELECT * FROM
patient_db
WHERE MATCH ( Name,id_number )
AGAINST ('% $term %' IN BOOLEAN MODE);");
但是如果我在这里输入多个单词,则无法运行查询.
$sql = MysqL_query("SELECT * FROM
patient_db WHERE
MATCH ( Name,id_number )
AGAINST ('+first_word +second_word +third_word' IN BOOLEAN MODE);");
如果你想做精确的搜索:
$sql = MysqL_query("SELECT *
FROM patient_db
WHERE MATCH ( Name,id_number )
AGAINST ('"exact phrase"' IN BOOLEAN MODE);");