comment like facebook script
<p>I already have an script where it will allow a user whom is logged in to comment on other users. One field for the usercommenting "men_id" and another field for the user being commented on commented_men_id. Well I save it in a comment table and to pull it I make a while I make a select to get the comment of men_id while getting the comment I do another while loop inside the while loop to get the user name and id to return it in the comment. Now the next step is to let other user to comment on top of the comment that is already there. I was wondering if I have to make another table or just create another table to get the comments on another comments. I was also wondering in terms of the php script will I have to create another while loop inside the second while loop to pull the subcomments?</p>

<p>So far I have the next structure</p>

<pre><code>$sql1 = "SELECT id, mem_id, commented_id, comment 
         FROM comments 
         WHERE commented_id = '$id'";

while($row=msql_fetch_array($sql)) {
  $id_coment = $row['id'];
  $mem_id = $row['mem_id'];
  $comment = $row['comment'];

  $sql_member_data = msql_query("SELECT id, member_name FROM users WHERE id ='$id_coment'");

  while($row2=msql_fetchj_array($sql_member_data)) {
    $user_id =$row2['id'];
    $user_name =$row2['member_name'];

    echo '&lt;div&gt;'.$user_name.'&lt;/div&gt;';

    echo '&lt;div&gt;'.$comment.'&lt;/div&gt;';
  }
}
</code></pre>

<p>I advise might not be the best code but it is posting the comment, Now how can I get a comment within the comment generated by this script. </p>

<p>Thank you guys.</p>
