-
Notifications
You must be signed in to change notification settings - Fork 0
/
news.php
124 lines (90 loc) · 3.45 KB
/
news.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require_once "config/techfestName.php";
require_once "config/configPDO.php";
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php echo $techfestName ?> | NEWS & NOTIFICATIONS</title>
<!-- Include Header Scripts -->
<?php include_once "includes/headerScripts.php"; ?>
<style>
hr {
border: 1px solid black;
margin-bottom: 25px;
}
</style>
</head>
<body>
<?php
try {
$sql = "SELECT * FROM news_information";
$result = $conn->prepare($sql);
$result->execute();
} catch (PDOException $e) {
echo "<script>alert('We are sorry, there seems to be a problem with our systems. Please try again.');</script>";
# Development Purpose Error Only
echo "Error " . $e->getMessage();
}
?>
<!--Include User Navbar-->
<?php include_once "includes/navbar.php" ?>
<main class="container">
<h1 class="text-center font-Staatliches-heading mt-5 text-uppercase">News & Notifications</h1>
<hr class="mb-5" style="border-top: 2px solid rgba(0,0,0,.1);"/>
<div class="row">
<?php
if ($result->rowCount() > 0) {
?>
<section class="col-md-12 mb-5">
<div class="table-responsive">
<table class="table table-bordered border-dark">
<thead class="text-center">
<tr>
<th>Sr. No</th>
<th>Tile</th>
<th>Description</th>
<th>Posted Date</th>
</tr>
</thead>
<tbody class="text-center">
<?php
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
?>
<tr>
<td><?php echo $row["id"]; ?></td>
<td class="text-justify"><?php echo $row["newsTitle"]; ?></td>
<td class="text-justify"><?php echo $row["newsDescription"]; ?></td>
<td><?php echo $row["postedDate"]; ?></td>
</tr>
<?php
}
} else {
echo "<script>Swal.fire({
icon: 'warning',
title: 'News Unavailable',
text: 'No News Available'
})</script>";
}
?>
</tbody>
</table>
</div>
</section>
</div>
</main>
<!--Include Footer & Footer Scripts-->
<?php
include_once 'includes/footer.php';
include_once "includes/footerScripts.php";
?>
<!--Include Footer & Footer Scripts-->
<script src="js/form-validation.js"></script>
<!--Close Database Connection-->
<?php $conn = null; ?>
</body>
</html>