我有这段代码不会产生任何东西,甚至不会产生错误消息。我试图在 while 循环中回显结果,但即使这样也没有显示任何内容。有小费吗?
foreach($droppedStudentIds as $value){
$query3 = "select * from student_classlists where StudentId = '$value' and ClassListDate = (select max(ClassListDate) from student_classlists)";
if($result = mysqli_query($mysqli, $query3)) {
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "Date: ".$row['ClassListDate'];
$droppedStudentIds[$value][] = $row['ClassListDate'];
}
mysqli_free_result($result);
} else die ("Could not execute query 3");
}
我的目标是查找 $droppedStudentIds 数组中每个元素的日期信息。我检查了 MySQL 查询本身,它产生了所需的结果。
谢谢!