33<head>
44 <meta charset="UTF-8">
55 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6- <title>Document </title>
6+ <title>Announcements </title>
77 <link rel="stylesheet" href="../../../assets/css/news.css" />
88</head>
99<body>
1010 <?php include '../admin.php ' ; ?>
11- <!-- Main Content -->
11+
1212 <div class="main-content-3">
1313 <h3>Announcements</h3>
1414
2020 <th>Date Posted</th>
2121 <th>Actions</th>
2222 </tr>
23+ </thead>
24+ <tbody>
25+
2326 <?php
24- $ servername = "localhost " ;
25- $ username = "root " ;
26- $ password = "" ;
27- $ dbname = "saklaw " ;
27+ $ servername = "localhost " ;
28+ $ username = "root " ;
29+ $ password = "" ;
30+ $ dbname = "saklaw " ;
2831
29- $ conn = mysqli_connect ($ servername , $ username , $ password , $ dbname );
32+ $ conn = mysqli_connect ($ servername , $ username , $ password , $ dbname );
3033
31- if (!$ conn ) {
32- die ("Connection failed: " . mysqli_connect_error ());
33- }
34+ if (!$ conn ) {
35+ die ("Connection failed: " . mysqli_connect_error ());
36+ }
3437
35- $ sql = "SELECT * FROM newupdate " ;
36- $ result = mysqli_query ($ conn , $ sql );
38+ $ sql = "SELECT * FROM newupdate " ;
39+ $ result = mysqli_query ($ conn , $ sql );
3740
38- if (mysqli_num_rows ($ result ) > 0 ) {
39- while ($ rows = mysqli_fetch_assoc ($ result )) {
40- echo "<tr> " ;
41- echo "<td> " . $ rows ["title " ] . "</td> " ;
42- echo "<td> " . $ rows ["Content " ] . "</td> " ;
43- echo "<td> " . $ rows ["date " ] . "</td> " ;
41+ if (mysqli_num_rows ($ result ) > 0 ) {
4442
45- echo "<td>
46- <form method='POST' action='edit.php'>
47- <input type='hidden' name='updateID' value=' " . $ rows ['updateID ' ] . "'>
48- <input type='submit' value=' Edit ' class='edit-btn'>
49- </form>
50- <br>
51- <form method='POST' action='delete.php'>
52- <input type='hidden' name='updateID' value=' " . $ rows ['updateID ' ] . "'>
53- <input type='hidden' name='newupdate' value='DELETE'>
54- <input type='submit' value=' Delete ' class='delete-btn'>
55- </td> " ;
56-
43+ while ($ rows = mysqli_fetch_assoc ($ result )) {
44+ echo "<tr> " ;
45+ echo "<td> " . htmlspecialchars ($ rows ["title " ]) . "</td> " ;
46+ echo "<td> " . htmlspecialchars ($ rows ["Content " ]) . "</td> " ;
47+ echo "<td> " . htmlspecialchars ($ rows ["date " ]) . "</td> " ;
5748
58- echo "</tr> " ;
59- }
60- } else {
61- echo "<tr><td colspan='6' align='center'>No Result Found!!</td></tr> " ;
49+ echo "<td>
50+ <form method='POST' action='edit.php'>
51+ <input type='hidden' name='updateID' value=' " . $ rows ['updateID ' ] . "'>
52+ <input type='submit' value='Edit' class='edit-btn'>
53+ </form>
54+ <br>
55+ <form method='POST' action='delete.php'>
56+ <input type='hidden' name='updateID' value=' " . $ rows ['updateID ' ] . "'>
57+ <input type='hidden' name='newupdate' value='DELETE'>
58+ <input type='submit' value='Delete' class='delete-btn'>
59+ </form>
60+ </td> " ;
61+ echo "</tr> " ;
6262 }
6363
64- mysqli_close ( $ conn );
65- ?>
64+ } else {
65+ echo " <tr><td colspan='4' align='center'>No Result Found</td></tr> " ;
6666
67+ echo "<tr>
68+ <td colspan='4' align='center'>
69+ <form method='POST' action='edit.php'>
70+ <input type='submit' value='Add Announcement' class='edit-btn'>
71+ </form>
72+ </td>
73+ </tr> " ;
74+ }
75+
76+ mysqli_close ($ conn );
77+ ?>
78+
79+ </tbody>
6780 </table>
6881 </div>
69- </div>
7082</body>
71- </html>
83+ </html>
0 commit comments