我正在做一个 foreach 循环并选择等于该部分名称的每一行。但是,我还需要显示所有不等于任何部分名称的结果。下面是我的代码的一部分,它选择与节名相同的行。
$result2 = mysqli_query($con, "SELECT * FROM sections ORDER BY `order`");
$sectionnames = array();
while($row = mysqli_fetch_array($result2)) {
$sectionnames[] = $row['sectionname'];
}
foreach ($sectionnames as $sectionname) {
$result = mysqli_query($con,"SELECT * FROM faq WHERE section = '$sectionname' ORDER BY `order`");