forked from if-itb/IF3110-01-Simple-Blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomment_post.php
More file actions
30 lines (27 loc) · 1.01 KB
/
comment_post.php
File metadata and controls
30 lines (27 loc) · 1.01 KB
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
<?php
include "mysql.php";
include "phpfunction.php";
$id_post = $_GET['id'];
$nama = $_GET['Nama'];
$email = $_GET['Email'];
$tanggal = date('Y-m-d');
$komentar = $_GET['Komentar'];
$query = "INSERT INTO comments (id_post, nama, email, tanggal, komentar) VALUES ('$id_post', '$nama', '$email', '$tanggal', '$komentar')";
$sql = $con->query($query);
?>
<ul class="art-list-body">
<?php
$thecomments = $con->prepare("SELECT nama, tanggal, komentar FROM comments WHERE comments.id_post = '$id_post' ORDER BY tanggal, id_comment DESC");
$thecomments->execute();
$thecomments->bind_result($cnama, $ctanggal, $ckomentar);
while ($thecomments->fetch()):
?>
<li class="art-list-item">
<div class="art-list-item-title-and-time">
<h2 class="art-list-title"><a href="post.php"><?php echo $cnama; ?></a></h2>
<div class="art-list-time"><?php echo StrTanggal($ctanggal); ?></div>
</div>
<p><?php echo $ckomentar; ?> …</p>
</li>
<?php endwhile?>
</ul>