-1

如果我错了,请纠正我,但我认为 mysql_real_escape_string 应该在 (') 和 (") 等字符前面放置转义字符。我正在使用的简单设置如下。我期待看到创建的新记录在 phpMyAdmin 中查看时,在上述字符之前带有反斜杠,但转义字符不存在。

$text           = mysql_real_escape_string($_POST['text']);
$detailedText           = mysql_real_escape_string($_POST['detailedText']);
$type           = mysql_real_escape_string($_POST['type']);
$image          = mysql_real_escape_string($_POST['image']);
?>
<script> alert("<?php echo $text ?>");</script>

<?php
    $result = mysql_query(
        "INSERT INTO nodes (text, detailedText, type, image) 
        VALUES ('". $text . "','" . $detailedText . "','" . $type . "','" . $image . "')");  
    mysql_close($conn);
?>
4

1 回答 1

2

与 mysql_real_escape_string 那些转义字符不存储到数据库中

于 2011-06-22T05:21:10.187 回答