I have a comment box wherein users can post comments. These comments will be displayed in a while loop.

```
<?php

while ($rowsx=mysql_fetch_array($resultss1)){

echo "<div id='comments'>";
echo "<table class='table11'>";
echo "<tr>";
echo "<td class='sss'><img src='img/user.jpg'>";
echo "<p class='p999'>"  .$rowsx['username'];  
echo  "</p> </br>";
echo "<p class='p9date'>" .$rowsx['date_posted']. "</p> ";
echo "</td>";
echo "<td>";
echo "<p class='p9'>" .$rowsx['comment']. "</p> </br></br></br>";

echo "</td>";

echo "</tr>";
echo "</table>";

echo "<a href='reply1.php?r_comment=".$rowsx['comment']."&prod_id=".$row['prod_id']."'    class='reply_button'> REPLY </a>  ";
echo "</div>";

}

?>

```

Now other users can also reply to the comments of the user. I want to display their replies below each comments of other users but I can't seem to figure out how to do that.

Should I use another while loop inside the first while loop?

Sorry if I'm using mysql functions I know it's depreciated but its just a school project.

Here is my query for displaying comments:

```
$display_comments1="Select username,prod_id,comment,DATE_FORMAT(date_posted, '%m/%d/%Y %H:%i:%s' ) AS date_posted from comment where prod_id='$prod_id' order by date_posted DESC";
$resultss1=mysql_query($display_comments1);

if($resultss1 === FALSE) {
die(mysql_error()); // TODO: better error handling
}

```