-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnotices.php
60 lines (55 loc) · 1.16 KB
/
notices.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
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="css/table.css">
<head>
<title></title>
</head>
<style type="text/css">
ul {
display: block;
list-style-type: none;
margin-top: 1em;
margin-bottom: 1 em;
margin-left: 0;
margin-right: 0;
padding-left: 40px;
}
li { color: black;
text-decoration-style: inherit;
background: #ebebeb;
}
</style>
<body>
<div id=".scilist1">
<table >
<tr>
<th>Title</th>
<th>Body</th>
</tr>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "scdatabase";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT title,notice FROM notice";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td> " . $row["title"]."</td><td>".$row["notice"]."</td></tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</table>
</div>
</body>
</html>