php/mysql:如何不敏感地搜索大小写

发布于 2024-08-09 16:51:56 字数 302 浏览 4 评论 0原文

我有这个 UTF8 格式的表(排序规则是 utf8_bin,以防万一)。

我需要使用 LIKE '%$searchstring%' 在其中搜索字符串。

现在您必须使用确切的情况才能显示结果。有没有办法让它不区分大小写?

谢谢

更新 抱歉,找到了答案< /a>.

i have this table in UTF8 (collation is utf8_bin in case it matters).

I need to search in it for strings using LIKE '%$searchstring%' .

Right now you have to use the exact case in order for the results to show up. Is there a way to make it case insensitive ?

Thank you

UPDATE
sorry, found the answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

没企图 2024-08-16 16:51:56

使用:

WHERE LOWER(t.column) LIKE LOWER('%search_string%')

..或:

WHERE UPPER(t.column) LIKE UPPER('%search_string%')

参考:

Use:

WHERE LOWER(t.column) LIKE LOWER('%search_string%')

..or:

WHERE UPPER(t.column) LIKE UPPER('%search_string%')

References:

流绪微梦 2024-08-16 16:51:56

您的排序规则指定区分大小写。使用这个代替:

utf8_ci

Your collation specifies the case-sensitivity. Use this instead:

utf8_ci

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文