我在mysql中遇到了一些严重的问题。
在我的数据库中,我有许多xxx的记录™我想把它换成xxx©我在查询中使用了replace函数,但它不起作用,但当我回显查询并在phpmyadmin上运行时,它会影响行并正确替换。
我的数据库太大了,所以我无法在任何编辑器中下载、搜索和替换。
以下是我的查询:
$u="update category set name =replace(name,'xxx™','xxx©')";
and also tried with:
$u="update category set name =replace(name,'xxx&trade','xxx©')";
请帮我解决这个问题!!
您可以考虑将版权/商标符号从HTMLEntity转换为HTMLEntity,以方便向数据库传输数据。
参考:
-
http://www.php.net/manual/en/function.htmlentities.php
-
http://www.php.net/manual/en/function.htmlspecialchars.php
©版权符号:©
™商标符号:™
您必须设置mysql的character set
,然后您可以运行您的查询,因为您的查询包含特殊字符:
mysqli_set_charset($conn,'utf8');
其中$conn
是您的连接变量。
希望这能解决您的疑问。