简体   繁体   English

在 SQL LIKE 中忽略大小写敏感

[英]Ignore Case Sensitive in SQL LIKE

$keyword = $_POST['searchKeywords'];

$query = mysqli_query($con, "SELECT * FROM movie WHERE title LIKE '%$keyword%' LIMIT 5");

I'm getting $keyword from the input field via POST request.And I have to type the accurate title like 'The Order' with the same case sensitive So I should type the exact way it is.Is there any way to type with any case sensitive I want like 'the order' and get the result.I will appreciate your help thanks.我通过 POST 请求从输入字段中获取 $keyword。我必须输入正确的标题,如“订单”,并且区分大小写,所以我应该输入确切的方式。有什么方法可以输入任何区分大小写我想要“订单”并获得结果。感谢您的帮助,谢谢。

In MySQL string comparison can be case sensitive or case insensitive.在 MySQL 中,字符串比较可以区分大小写或不区分大小写。 This normally depends on the collation used not on operator (where, like).这通常取决于使用的排序规则而不是运算符(where,like)。

Read how case sensitivity works 阅读区分大小写的工作原理

i think you can apply that function first on the keyword variable before you use it我认为您可以在使用之前先在关键字变量上应用 function

strtolower("Hello WORLD."); strtolower("你好世界。");

you will get it as: hellow world.你会得到它:地狱世界。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM