我正在努力制作一个家庭作业计划员,而我却无法查询班级ID和家庭作业ID来过滤数据库,以便向学生展示他们自己的作业。我试图使用for循环过滤掉那些不适合用户的作业,但我一直在
注意:未定义的偏移量:在第109行的C:\ home \ site \ wwwroot \ calendar.php中为0
这是什么意思,是否有更好的方法来解决这个问题?
$user_id = $_SESSION['user_id'];
$link = mysqli_connect('mysql3.gear.host','baldwin','Baldwin1#','userinfo');
$query = mysqli_query($link, "SELECT * FROM events;") or die(mysql_error());
$query_classid = mysqli_query($link, "SELECT * FROM student_class WHERE user_id = $user_id;") or die(mysql_error());
$events = array();
$classID = array();
$eventID = array();
while($row = mysqli_fetch_assoc($query_classid)){
$classID[$row['class_id']][] = $row;
}
for($i = 0, $size = count($classID); $i < $size; ++$i){
$class_search = intval($classID[$i]);
print_r($class_search);
$query_class_event = mysqli_query($link, "SELECT * FROM student_events WHERE class_id = $class_search;") or die(mysql_error());
while($row = mysqli_fetch_assoc($query_class_event)){
$eventID[$row['event_id']][] = $row;
}
}
for($i = 0, $size = count($eventID); $i < $size; ++$i){
$event_search = intval($eventID[$i]);
$query_eventid = mysqli($link, "SELECT * FROM events WHERE event_id = '$event_search';") or die(msql_error());
while($row = mysqli_fetch_assoc($query_eventid)){
$events[$row['duedate']][] = $row;
}
}