-
Notifications
You must be signed in to change notification settings - Fork 6
/
display.php
52 lines (42 loc) · 1.13 KB
/
display.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
<?php
require('db.php');
session_start();
if(!isset($_SESSION["username"])){
header("Location: basicdiary.php");
exit(); }
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="displaystyle9.css">
<title>DIARY DISPLAY</title>
</head>
<body>
<div class="bg-image">
<img src="displaybg.jpg" class = "image" >
</div>
<div class="box">
<?php
$date = date("Y-m-d");
$sql = "SELECT * FROM diary_entry where username ='$_SESSION[username]';";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>DATE</th><th>DIARY</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>  ".$row["Date"]."</td><td>    ".$row["Diary"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</div>
<div class="footer"> <a href = "start.php" >
<button type = "button" class = "back">BACK</button><br>
</a> <br></div>
</body>
</html>