我有一段PHP语句,应该打印所有类似的东西
$full = "SELECT * FROM $table WHERE question LIKE '%$question%'";
$fullQ = mysqli_query($conn, $full);
while($row = mysqli_fetch_assoc($fullQ)) {
printf(nl2br("%s\n"), $row['question']);
}
但它只用utf-8打印一个结果 我已经逃脱了数据但没有任何内容
答案 0 :(得分:-1)
您是否尝试在$ full之前放置一个真正的转义字符串?
$question = mysqli->real_escape_string($question);
$full = "SELECT * FROM $table WHERE question LIKE '%$question%'";
$fullQ = mysqli_query($conn, $full);
while($row = mysqli_fetch_assoc($fullQ)) {
printf(nl2br("%s\n"), $row['question']);
}