Home >Backend Development >PHP Tutorial > php操作带有双引号及单引号的有关问题

php操作带有双引号及单引号的有关问题

WBOY
WBOYOriginal
2016-06-13 12:36:211006browse

php操作带有双引号及单引号的问题
因为没有开启magic_quotes_gpc, 所以插入数据库的时候, 所有带有单引号和双引号的数据前面加了个反斜杠,
我想将这些数据查询出来, 将反斜杠去掉更新一下, 但是测试了几个方式都不行 

$query = "SELECT id,title FROM  `test` WHERE  `title` LIKE  '%\'%' OR `title` LIKE  '%\"%'";<br />
<br />
$query = mysql_query($query);<br />
while($res =mysql_fetch_assoc($query)){<br />
    $title = stripslashes($res['title']);<br />
    $sql ="UPDATE `test` SET `title`={$title} WHERE id=$res['id']";<br />
    mysql_query($sql);<br />
}

php 数据库
Statement:
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