-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.php
27 lines (22 loc) · 1.37 KB
/
count.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
$school_year_query = mysqli_query($conn,"select * from school_year order by school_year DESC")or die(mysqli_error());
$school_year_query_row = mysqli_fetch_array($school_year_query);
$school_year = $school_year_query_row['school_year'];
?>
<?php $query_yes = mysqli_query($conn,"select * from teacher_class_student
LEFT JOIN teacher_class ON teacher_class.teacher_class_id = teacher_class_student.teacher_class_id
LEFT JOIN class ON class.class_id = teacher_class.class_id
LEFT JOIN subject ON subject.subject_id = teacher_class.subject_id
LEFT JOIN teacher ON teacher.teacher_id = teacher_class_student.teacher_id
JOIN notification ON notification.teacher_class_id = teacher_class.teacher_class_id
where teacher_class_student.student_id = '$session_id' and school_year = '$school_year' order by notification.date_of_notification DESC
")or die(mysqli_error());
$count_no = mysqli_num_rows($query_yes);
?>
<?php $query_no = mysqli_query($conn,"select * from notification
LEFT JOIN notification_read ON notification_read.notification_id = notification.notification_id
where notification_read.student_id = '$session_id'
")or die(mysqli_error());
$count_yes = mysqli_num_rows($query_no);
?>
<?php $not_read = $count_no - $count_yes; ?>