-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetComments.php
66 lines (59 loc) · 2.05 KB
/
getComments.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
<?php
include('session.php');
if (!isset($_SESSION['login_user'])) {
header("location: account_creation.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script src="lorem.js"></script>
<link rel="stylesheet" href="main.css">
<!-- next link is for the star rating system -->
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<title>Writely</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial scale=1.0">
</head>
<div id="page-container">
<div id="content-wrap">
<header>
<div id="logo">Writely</div>
<nav>
<ul class="nav__links">
<li><a href="Project.php">Home</a></li>
<li><a href="profile.php">Profile</a></li>
<li><a href="upload.php">Upload</a></li>
<li><a> Welcome, <?php echo $login_session; ?></a></li>
<li><a href="logout.php"> Logout</a></li>
</ul>
</nav>
<form action="searchresults.php" method="post">
<input type="text" name="search" placeholder="Search posts">
<input type="submit" value="Go">
</form>
</header>
</div>
</div>
<div class="landing">
<div class="comment_post">
<?php
$host = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "accounts";
$conn = new mysqli($host, $dbuser, $dbpass, $dbname);
$sql = "SELECT username, textt FROM comments";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while ($row = $result->fetch_assoc()) {
echo "" . $row["username"] . " Says: " . $row["textt"] . "<br><br>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</div>
</div>