-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
55 lines (47 loc) · 1.21 KB
/
view.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
<?php
$host = "localhost";
$database = "diary";
$user = "root";
$password = "";
$connection = mysqli_connect($host,$user,$password,$database);
session_start();
if(!isset($_SESSION["loggedin"])){
header("location: index.html");
exit;
}
$selectsql = "SELECT * FROM tasks";
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
if ($result = mysqli_query($connection,$selectsql)) {
echo '
<a href="../diary/main.php" class="home"><i class="fas fa-home"></i></a>
<h2>DIARY</h2>
<table>
<tr>
<th class="head"><b>DATE</b></th>
<th class="head"><b>DESCRIPTION<b></th>
</tr>';
while ($row = $result->fetch_assoc()) {
echo '
<tr>
<th>'.$row["date"].'</th>
<th>'.$row["description"].'</th>
</tr>';
}
} else {
echo "0 results";
}
echo '</table>';
mysqli_close($connection);
?>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<script src="https://kit.fontawesome.com/b99e675b6e.js"></script>
<link rel="stylesheet" href="css/view.css">
<body style="background:url(image.jpg); background-repeat:no-repeat;background-size:100% ">
</body>
</head>
</html>