gusto ko kapag click ko tong code na to
if(isset($_GET['id'])){
$id_comment = $_GET['id'];
// Query to fetch the specific content based on the comment_id
$content_query = mysqli_query($con, "SELECT * FROM post WHERE comment_id = '$id_comment'") or die(mysqli_error());
$content_row = mysqli_fetch_array($content_query);
if (mysqli_num_rows($content_query) > 0) {
// Code to display the content
echo '<div class="container col-md-6 bg-body-tertiary border rounded-3">'.$content_row['comment'].'</div>';
} else {
// Code to handle when no content is found
}
}
?>
marereplace nya itong code na to
<?php
if (isset($_POST['comment'])){
$comment_content = $_POST['comment_content'];
$post_id=$_POST['id'];
mysqli_query($con,"insert into comment (comment,date_posted,user_id,comment_id) values ('$comment_content','".strtotime(date("Y-m-d h:i:sa"))."','$user_id','$post_id')") or die (mysqli_error());
header('Location: comment.php');
exit();
ob_end_flush();}
?>
<?php
$comment_query = mysqli_query($con,"SELECT DISTINCT DISTINCT * ,UNIX_TIMESTAMP() - date_posted AS TimeSpent FROM comment inner JOIN registration on registration.user_id = comment.user_id where comment.comment_id = '$id' order by date_posted DESC") or die (mysqli_error());
while ($comment_row=mysqli_fetch_array($comment_query)){
$comment_id = $comment_row['id'];
$comment_by = $comment_row['username'];
?>
<div class="mb-3">
<?php echo $comment_row['comment'];
?>
</div>
yun dalawang echo
if(isset($_GET['id'])){
$id_comment = $_GET['id'];
// Query to fetch the specific content based on the comment_id
$content_query = mysqli_query($con, "SELECT * FROM post WHERE comment_id = '$id_comment'") or die(mysqli_error());
$content_row = mysqli_fetch_array($content_query);
if (mysqli_num_rows($content_query) > 0) {
// Code to display the content
echo '<div class="container col-md-6 bg-body-tertiary border rounded-3">'.$content_row['comment'].'</div>';
} else {
// Code to handle when no content is found
}
}
?>
marereplace nya itong code na to
<?php
if (isset($_POST['comment'])){
$comment_content = $_POST['comment_content'];
$post_id=$_POST['id'];
mysqli_query($con,"insert into comment (comment,date_posted,user_id,comment_id) values ('$comment_content','".strtotime(date("Y-m-d h:i:sa"))."','$user_id','$post_id')") or die (mysqli_error());
header('Location: comment.php');
exit();
ob_end_flush();}
?>
<?php
$comment_query = mysqli_query($con,"SELECT DISTINCT DISTINCT * ,UNIX_TIMESTAMP() - date_posted AS TimeSpent FROM comment inner JOIN registration on registration.user_id = comment.user_id where comment.comment_id = '$id' order by date_posted DESC") or die (mysqli_error());
while ($comment_row=mysqli_fetch_array($comment_query)){
$comment_id = $comment_row['id'];
$comment_by = $comment_row['username'];
?>
<div class="mb-3">
<?php echo $comment_row['comment'];
?>
</div>
yun dalawang echo