MYSQL 特殊字符怎么办

WBOY
Release: 2016-06-13 13:34:20
Original
886 people have browsed it

MYSQL 特殊字符怎么处理?
这个语句
mysql_query("update users set active_date = '2012-3-13' where computer_key = '18:A9:05:A1:3D:83 90:4C:E5:A1:36:2A'");

就因为后面有冒号或者空格的存在,导致无法更新。
我该怎么处理一下啊?谢谢了。

------解决方案--------------------
你弄错了吧,冒号或空格都不是特殊字符。没更新成功可能是因为数据库中没有匹配到行
------解决方案--------------------
如果你确定冒号和空格是多余的,则过滤之啊。

PHP code
$s=preg_replace('/[: ]/','',$s);
<br><font color="#e78608">------解决方案--------------------</font><br>按这个条件select一下  看有没有结果出来
<br><font color="#e78608">------解决方案--------------------</font><br>转义一下
<br><font color="#e78608">------解决方案--------------------</font><br>如果是特殊字符,用htmlentities可以转义。说明下,空格绝对不是特殊字符。 <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template