我有一个表单,用户在其中输入数据并将其输入mysql数据库。问题是当他们输入了“%”符号或其他特殊字符时,当我的网站试图显示记录时,会导致问题。它实际上导致在显示结果时不显示该记录的任何内容。我该怎么解决这个问题?
$query = "SELECT * FROM makerperk WHERE pid='$pid' LIMIT 1";
$result = mysqli_query($connection, $query) or die(mysqli_error($connection));
while($row = mysqli_fetch_assoc($result)) {
$makerid = $row['makerid'];
$name = $row['name'];
$title = $row['title'];
$perkdescription = $row['perkdescription'];
$image = $row['image'];
$perktype = $row['perktype'];
$restrictions = $row['restrictions'];
}
1条答案
按热度按时间y1aodyip1#
我认为你应该使用php mysqli\u real\u escape\u string