How can I integrate this html within this php loop?
<p>I have this PHP code I am trying to integrate with the html layout below it however I can not figure it out, the php
code gets all status post and displays them in order but it then displays all comments that are associated with the status post so a status post could have
0 comments or it could have multiple comments.</p>

<p>If you read the notes I left in the PHP code and the notes I left in the html you will see the problem I am facing
I need to put the comments inside the table cell of the status post somehow</p>

<p>In the image below there is 1 status post and 3 comments for that post, what I am trying to do is get the comments to show up in there own table that will be nested in the right side right under the status post.  So on the status post @ the top you see a table border at the bottom of that post, that border should be below the last comment for that post, hope that makes a little more sense now</p>

<p><img src="http://i32.tinypic.com/2afnc3l.jpg" alt="alt text" /></p>

<pre><code>&lt;?PHP
$last_id = 0;
echo '&lt;table width="400"&gt;';
while ($row = mysql_fetch_array($res)) {
    //start output of new status post and comments
    if ($row['0'] != $last_id) {
     echo 'status post stuff'
    }
    //start output of new status post and comments

    //output comment here
    $last_id = $row['0'];
    if($row['commentid'] != ''){
     echo 'status COMMENT for above status post'
    }
    //END output comment here
}
echo '&lt;/table&gt;';
?&gt;

&lt;table width="400"&gt;

    &lt;!-- begin status post --&gt;
    &lt;tr&gt; 
     &lt;td width="99" valign="top" style="border-bottom: 1px solid rgb(204, 204, 204); margin: 0px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"&gt; &lt;div class="imageSub" style="width: 90px;"&gt; &lt;img class="female" src="http://cache2.mycrib.net/images/image_group66/0/43/t_6871399b0962b5fb4e29ce477541e165950078.jpg" alt="Something" width="90"/&gt; &lt;/div&gt;&lt;/td&gt;
     &lt;td width="489" style="border-bottom: 1px solid rgb(204, 204, 204); margin: 0px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"&gt;so and so said blah blah blah @ wee hours of the moring! &lt;BR&gt;

      &lt;!-- begin comment --&gt;
      &lt;table width="90%" style="border: 1px solid rgb(204, 204, 204); margin: 0px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;"&gt;
       &lt;tr&gt;
        &lt;td width="14%" rowspan="2" valign="top"&gt;&lt;img class="male" src="http://cache2.mycrib.net/images/image_group34/0/39/T_653807517aff2b1f5662d865b40d87d527c8eb.jpg" alt="Something" width="45"/&gt;&lt;/td&gt;
        &lt;td width="86%"&gt;Date Posted&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
        &lt;td&gt;Comment text&lt;/td&gt;
       &lt;/tr&gt;
      &lt;/table&gt;
      &lt;!-- end comment --&gt;

     &lt;/td&gt;
    &lt;/tr&gt;
  &lt;!-- end status post --&gt;

&lt;/table&gt;
</code></pre>
