nais ko sana na bilang admin gusto ko na kapag di kaaya aya yun post nya idedelet ko bilang admin..
ito code ko sa dashboard.php
<?php
$sql = mysqli_query($con, "SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM post inner join registration on registration.user_id = post.user_id order by date_created DESC") or die (mysqli_error());
while($post_row = mysqli_fetch_array($sql,)){
$id_user = $post_row['username'];
$id_comment = $post_row ['comment_id'];
?>
<div class="comet" >
<div><h6>   <i class="fa fa-id-card-o"> </i><?php echo $id_user;?>    <i class="icon1 fa fa-hand-o-right" ></i>     <a href="posting.php?id=<?php echo $id_comment;?>"><?php echo $post_row['title']; ?></a>
<br>
<div class="date-time">   
<?php
$days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $post_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';
elseif($days == 0)
echo $days.' day ago';
?>
<img src="../img/hour.png" alt= "hour logo" style = "width:10px";>
<a href= 'commentdelete.php?comment_id<?php $id_comment ?>'>Delete</a>
</h6></div>
</div>
<?php }?>
ito din code ko sa commentdelete.php
<?php
include '../config/config.php';
$id_comment = $_REQUEST['comment_id'];
$sql_delete = mysqli_query($con, "SELECT * FROM post where comment_id = '$id_comment'");
?>
ito code ko sa dashboard.php
<?php
$sql = mysqli_query($con, "SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM post inner join registration on registration.user_id = post.user_id order by date_created DESC") or die (mysqli_error());
while($post_row = mysqli_fetch_array($sql,)){
$id_user = $post_row['username'];
$id_comment = $post_row ['comment_id'];
?>
<div class="comet" >
<div><h6>   <i class="fa fa-id-card-o"> </i><?php echo $id_user;?>    <i class="icon1 fa fa-hand-o-right" ></i>     <a href="posting.php?id=<?php echo $id_comment;?>"><?php echo $post_row['title']; ?></a>
<br>
<div class="date-time">   
<?php
$days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $post_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';
elseif($days == 0)
echo $days.' day ago';
?>
<img src="../img/hour.png" alt= "hour logo" style = "width:10px";>
<a href= 'commentdelete.php?comment_id<?php $id_comment ?>'>Delete</a>
</h6></div>
</div>
<?php }?>
ito din code ko sa commentdelete.php
<?php
include '../config/config.php';
$id_comment = $_REQUEST['comment_id'];
$sql_delete = mysqli_query($con, "SELECT * FROM post where comment_id = '$id_comment'");
?>