bakit po yun kapag nirereload ko nauulit yun output.. pero kapag di ko nag reload ok nman pero kapag nag refresh ako o nag reload nauulit po yun output
<form method="post">
<div class="container col-md-6">
Comment:<br>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<textarea name="comment_content" class="form-control" rows="4" cols="50" style="" placeholder=".........Type your comment here........" required></textarea><br>
<input class="w-25" type="submit" name="comment" value ="Reply" style="background-color:#0D52C7;">
</div>
</form>
</br>
<?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());
}
?>
<?php
$comment_query = mysqli_query($con,"SELECT * ,UNIX_TIMESTAMP() - date_posted AS TimeSpent FROM comment inner JOIN registration on registration.user_id = comment.user_id where 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'];
?>
<br><div class="container col-md-6 bg-body-tertiary border rounded-3"><?php echo $comment_by; ?> - <?php echo $comment_row['comment']; ?>
<br>
<?php
$days = floor($comment_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $comment_row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if($days > 0)
echo date('F d, Y - H:i:sa', $comment_row['date_posted']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
?>
</div>
<br>
<?php
}
?>
<hr
<?php
if ($u_id = $id){
?>
<?php }else{ ?>
<?php
} } ?>
</body>
</html>
<form method="post">
<div class="container col-md-6">
Comment:<br>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<textarea name="comment_content" class="form-control" rows="4" cols="50" style="" placeholder=".........Type your comment here........" required></textarea><br>
<input class="w-25" type="submit" name="comment" value ="Reply" style="background-color:#0D52C7;">
</div>
</form>
</br>
<?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());
}
?>
<?php
$comment_query = mysqli_query($con,"SELECT * ,UNIX_TIMESTAMP() - date_posted AS TimeSpent FROM comment inner JOIN registration on registration.user_id = comment.user_id where 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'];
?>
<br><div class="container col-md-6 bg-body-tertiary border rounded-3"><?php echo $comment_by; ?> - <?php echo $comment_row['comment']; ?>
<br>
<?php
$days = floor($comment_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $comment_row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if($days > 0)
echo date('F d, Y - H:i:sa', $comment_row['date_posted']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
?>
</div>
<br>
<?php
}
?>
<hr
<?php
if ($u_id = $id){
?>
<?php }else{ ?>
<?php
} } ?>
</body>
</html>