Correct my if I'm wrong, but I thought mysql_real_escape_string was supposed to place escape characters in front of character like (') and ("). The simple setup that I am using is below. I was expecting to see the new record created with backslashes before the above mentioned characters 开发者_运维百科when viewed in phpMyAdmin but the escape characters are not present.
$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);
?>
with mysql_real_escape_string Those escape character are not stored into database
精彩评论