SQL里面有LIKE和json_encode

时间:2014-02-05 13:18:41

标签: php sql database json sql-like

我有一个大问题。

我的数据库列如下所示:

{"79":"novej nazev ","53":"","54":"0","55":"0","56":"\u0159\u0159\u0159\u0159\u0159","57":"","58":"","59":"","60":"","61":"","62":"","63":"","64":"","65":"","66":"","67":"","68":["",""],"69":"0","70":["",""],"71":["",""],"72":["",""]}

有数组和json_encode(数组)

所以现在我想在数据库中搜索一些带有变音符号但是json_encode将变音符号转换为(\ u0159 \ u0159 \ u0159 \ u0159 \ u0159)

好的没问题所以我转换为$search_word=json_endoce(SEARCH WORD);搜索单词。

现在我将通过脚本进行搜索: data LIKE '%$search_word%'但是没有任何东西都不会获​​得forim数据库

那么我做错了什么?

1 个答案:

答案 0 :(得分:1)

我建议你不要用json_encode来逃避unicode字符:

json_encode($value, JSON_UNESCAPED_UNICODE);

MySQL在MySQL中得到很好的支持。你不需要逃避这些角色。