Warning: Undefined variable $post_row in C:\xampp\htdocs\Innerjoin\user\posting.php on line 62
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\Innerjoin\user\posting.php on line 62
bakit kaya ganito error ilan araw lang di ko nabuksan.. siguro sa hours, days po ang error nya
$post_query = mysqli_query($con, "SELECT *,UNIX_TIMESTAMP() - date_created as TimeSpent FROM post left join registration on registration.user_id = post.user_id where comment_id = '$id_comment' order by comment_id DESC limit 1 ") or die(mysqli_error($con));
// loop
while ($content_row = mysqli_fetch_array($post_query)){
$id = $content_row['comment_id']; //get the comment_id
$uid = $content_row['user_id']; //get the user_id
$postedby = $content_row['username']; //get the username
?> <div class="container col-md-6 bg-body-tertiary border rounded-3 mb-2 p-3">
<h5>Title: <?php echo $content_row['title']; ?></h5>
</div>
<!-- body of posted -->
<div class="container col-md-6 bg-body-tertiary border rounded-3">
<p>Posted by: <a href="#" style= "margin-left:10px; text-decoration:none;"> <?php echo $postedby; ?></a>
<!-- time interval --><br>
<?php
$days = floor($content_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $content_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', $post_row['date_created']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
?>
Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\Innerjoin\user\posting.php on line 62
bakit kaya ganito error ilan araw lang di ko nabuksan.. siguro sa hours, days po ang error nya
$post_query = mysqli_query($con, "SELECT *,UNIX_TIMESTAMP() - date_created as TimeSpent FROM post left join registration on registration.user_id = post.user_id where comment_id = '$id_comment' order by comment_id DESC limit 1 ") or die(mysqli_error($con));
// loop
while ($content_row = mysqli_fetch_array($post_query)){
$id = $content_row['comment_id']; //get the comment_id
$uid = $content_row['user_id']; //get the user_id
$postedby = $content_row['username']; //get the username
?> <div class="container col-md-6 bg-body-tertiary border rounded-3 mb-2 p-3">
<h5>Title: <?php echo $content_row['title']; ?></h5>
</div>
<!-- body of posted -->
<div class="container col-md-6 bg-body-tertiary border rounded-3">
<p>Posted by: <a href="#" style= "margin-left:10px; text-decoration:none;"> <?php echo $postedby; ?></a>
<!-- time interval --><br>
<?php
$days = floor($content_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $content_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', $post_row['date_created']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
?>