下面是我的脚本,我用它来插入我的数据库。我没有使用stripslashes or mysqli_escape,因为我读到,当您使用准备语句时,我们不需要使用它。我面临的问题是,下面的方法在安全性和每次插入时都是很好的,然后将特殊字符的垃圾文本存储在我的数据库中,如下例所示。请告诉我如何修改查询,以便当用户保存这些值时,它会存储这些值。谢谢,
You shouldn’t move them to the next level of delegation.
$storeit = $_POST['value'];
$stmt = $con->prepare("INSERT INTO db_table (thevalue) VALUES (?)");
$stmt->bind_param("s", $storeit); /// s means only string input is allowed
if ($stmt->execute())
{
echo "true";
}
else
echo "false".$stmt->error;https://stackoverflow.com/questions/22088979
复制相似问题