where 条件下的 Unicode 字符 - phpmyadmin

Unicode characters in where condition - phpmyadmin

我确定这与我设置服务器的方式有关。总服务器菜鸟。

当我输入查询时

SELECT * FROM `models` WHERE `sex` = 'x' 

我收到一条错误消息

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&#039 x &#039 '

SELECT * FROM `models` WHERE `sex` = &#039 x  &#039

我已经删除了;为清楚起见,来自代码示例。

这是我需要更改的 php.ini 设置吗?这是输入转换吗?

提前致谢。

写SQL时不要使用"html entities"。

' 是一种编码撇号 ' 以在网页上显示的方法。我不知道您是如何将其放入代码中的,但这似乎是问题所在。

仅使用 PHP 函数 htmlentities() 写入网页。

您使用的是什么编辑器?

编辑:

检查 php.ini。您可能需要 magic_quotes_gpc = Off