如果我錯了,更正我的錯誤,但我認爲mysql_real_escape_string應該把轉義字符放在像(')和(「)這樣的字符前面,我正在使用的簡單設置如下。我期待看到在phpMyAdmin看,但轉義字符不存在上述字符之前反斜槓創造了新的紀錄。mysql_real_escape_string沒有放置轉義字符
$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);
?>
因爲它是未轉義的 – Ibu