MYSQL:类似于方法,类似单词-但不显示搜索到的单词 [英] MYSQL: Like Method, Similar Words - But Don't Show the Searched Word

查看:98
本文介绍了MYSQL:类似于方法,类似单词-但不显示搜索到的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我使用这种方法来显示搜索请求中的相似单词.

actually i use this method to show similar words for a search request..

$query = "SELECT * FROM searches WHERE Query LIKE '%$search%' ORDER BY Query"; 

如果有人搜索"nelly",它将在数据库中查找相似的字词

if someone searches for "nelly" it looks up in the database for similar words

内莉·费塔多,内莉·凯利" ...

"nelly furtado, nelly ft. kelly"...

但是我不想显示搜索到的单词.

but i dont want to show up the searched word..

示例:您已经搜索过内莉-也可以尝试以下操作:内莉,内莉·费塔多,内莉·英尺

example: you've searched for nelly - try this too: nelly, nelly furtado, nelly ft.,

不应该再次显示粗体字,因为它是搜索到的字..也许有一种使用MATCH AGAINST的方法吗?谢谢!

the bold word should not showed up again, because it's the searched word.. is there maybe a method with MATCH AGAINST? thank you!

推荐答案

您不可以做...WHERE Query LIKE "%$search%' AND Query <> '$search'...之类的事情吗?

Couldn't you just do something like ...WHERE Query LIKE "%$search%' AND Query <> '$search'...?

不区分大小写:Query LIKE "%$search%' AND STRCMP(Query, '$search') == 0

这篇关于MYSQL:类似于方法,类似单词-但不显示搜索到的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆