paano ko kaya maicconnect yun $id_comment sa kabilang file
itong sa una code ko is nasa kabilang file na post.php
<?php
if (isset($_POST['comment'])){
$comment_content = $_POST['comment_content'];
$post_id=$_POST['comment_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 comment.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'];
?>
itong sa pangalawang code ko is nasa kabilang file na post.php
include '../config/config.php';
include '../partials/session.php';
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);
$content_query = mysqli_query($con, "SELECT * FROM comment WHERE comment_id = '$id_comment'") or die(mysqli_error());
$content_row = mysqli_fetch_array($content_query);
?>
<script>
window.location = 'postinsert.php';
</script>
<?php
}
?>
itong sa una code ko is nasa kabilang file na post.php
<?php
if (isset($_POST['comment'])){
$comment_content = $_POST['comment_content'];
$post_id=$_POST['comment_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 comment.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'];
?>
itong sa pangalawang code ko is nasa kabilang file na post.php
include '../config/config.php';
include '../partials/session.php';
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);
$content_query = mysqli_query($con, "SELECT * FROM comment WHERE comment_id = '$id_comment'") or die(mysqli_error());
$content_row = mysqli_fetch_array($content_query);
?>
<script>
window.location = 'postinsert.php';
</script>
<?php
}
?>