【发布时间】:2019-08-06 06:49:36
【问题描述】:
我遇到了一些关于非拉丁字符的问题。
查询:
SELECT * FROM table WHERE name LIKE '%{$phrase}%'
PHP:
$phrase = $_POST['phrase'];
//$phrase = strtolower/strtoupper($_POST['phrase']) made no differece
演示数据库:
Asomething (in the db stored as Asomething)
asomething (in the db stored as asomething)
Äsomething (in the db stored as Äsomething)
äsomething (in the db stored as äsomething)
无论我输入 a 还是 A,我都会得到我想要的 - 两个结果,但是... 如果我输入 Ä,我会得到 只有一个结果包含大写。我怎样才能同时获得它们?
已编辑:我使用排序规则 utf8_general_ci
【问题讨论】:
-
排序规则设置是什么?您想在 php 中尝试
mb_函数吗? php.net/manual/en/function.mb-strtolower.php“Utf-8 一路通过”? -
您在表中使用什么字符集和排序规则?您应该将其全部设置为 UTF-8。
-
stackoverflow.com/q/279170/2943403 如果副本不能解决您的问题,可以重新打开页面。现在,您有责任证明您一直执行建议。
标签: php mysql character sql-like