开发者

mysql_real_escape_string is not placing escape characters

开发者 https://www.devze.com 2023-03-14 08:56 出处:网络
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 expec

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

0

精彩评论

暂无评论...
验证码 换一张
取 消