PHP MySQL utf 8 编码
我试图对 PHP 函数进行 Ajax 调用,以从数据库中提取数据。不过我遇到了问题。
我的查询看起来像这样,
$query = "SELECT * FROM mytable WHERE field LIKE '%$string%'"
然后检查查询返回的行数,但是当我输入 æ ø å 时,我的查询返回 0 行,尽管我知道数据库中有包含 æ ø å 的条目。这是为什么
My trying to make an Ajax call to a PHP function that pulls out data from my database. I've run into a problem though.
My query looks like this
$query = "SELECT * FROM mytable WHERE field LIKE '%$string%'"
I then check on the number of rows returned by the query, but when i type in æ ø å then i my query returns 0 rows, although I know there are entries in the database that have æ ø å.. why is this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就我而言,我必须添加这一行:
in my case, I had to add this line:
将连接设置为使用 UTF-8:
Set the connection to use UTF-8: