title: Deleting entire family of a comment thread
body: <p>Ok, so here is my problem. I am implementing a forum for a client of mine. The code was written years ago and I am working on a delete feature.</p>
  
  <p>Basically, you have your Primary topic. People can comment on that, and comment then on the comments.</p>
  
  <p>The layout would be as such:<br/><br/>
  [ Main Post ]<br/>
  &nbsp;&nbsp;[Comment A - ID 1 - Family Founder]<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;[Comment 2 - Parent 1 - ID 2]<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;[Comment 3 - Parent 1 - ID 3]<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Comment 4 - Parent 3 - ID 4]<br/>
  &nbsp;&nbsp;[COmment B - ID 5 - Family Founder]<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;[Comment 6 - Parent 5 - ID 6]<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Comment 7 - Parent 6 - ID 7]<br/></p>
  
  <p>The table stores this info as follows:
  ID | Parent ID | Topic ID | Comment Content</p>
  
  <p>Currently, it is setup to run with two functions
  The first, calls the primary comment (Comment ID 1) and then at the bottom, it calls to see if there are any children of comment ID 1 then loops through them, etc. It is confusing to try to explain.</p>
  
  <p>The problem is, I am unable to keep track of the initial family found (A and B, IDs 1 and 5 respectively). </p>
  
  <p>The only way I can think to do this is to call a function making a multitude of queries on the database until the children count is 0. Storing all the IDs then running a delete query. </p>
  
  <p>Any help is appreciated. If I can explain it better please let me know.</p>