-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification.php
77 lines (63 loc) · 2.02 KB
/
notification.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
$servername = "localhost";
$server_username = "root";
$server_password = "";
$dbname = "ping";
// Create connection
$conn = new mysqli($servername, $server_username, $server_password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query="SELECT username, course, type, date, month, venue FROM notifications";
$result=mysqli_query($conn, $query);
$i = 0;
$countAll = $result->num_rows;
if ($countAll > 0) {
while($row = $result->fetch_assoc()) {
$prof[$i] = $row["username"];
$course[$i] = $row["course"];
$type[$i] = $row["type"];
$venue[$i] = $row["venue"];
$date[$i] = $row["date"];
$month[$i] = $row["month"];
$year = '2017';
$i++;
}
}
else {
echo "0 results";
}
$conn->close();
?>
<body>
<!--The parent card gorup starts here!-->
<div id="notification-list"
class="ui cards"
style="overflow-y: auto;
min-height: 12vw;">
</div>
</body>
<script type="text/javascript" src="js/notifications.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var date = [];
var month = [];
var venue = [];
var type = [];
var prof = [];
var course = [];
<?php for ($i = 0; $i < $countAll; $i++) {?>
date.push("<?php echo $date[$i]; ?>");
month.push("<?php echo $month[$i]; ?>");
prof.push("<?php echo $prof[$i]; ?>");
venue.push("<?php echo $venue[$i]; ?>");
course.push("<?php echo $course[$i]; ?>");
type.push("<?php echo $type[$i]; ?>");
<?php }?>
for(var i = 0; i < prof.length; i++){
console.log(<?php echo $countAll; ?>);
getNotifications(type[i], date[i], month[i], venue[i], prof[i], course[i]);
}
});
</script>