I have these two sets of code (shown below) I want to make the second one run within the WHILE loop of the first. Is there anyway to do it?
<?php
include ("dbConfig.php");
$result = mysql_query("SELECT * FROM posts");
echo "<table border=0>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td><font face=verdana size=2><b>%s</b><br><font face=verdana size=1>Posted by %s<br><br><font face=verdana size=2>%s<br><a href=\"comment.php?id=%s\">Comment on this post</a> - <a href=\"view_comments.php?id=%s\">View comments about this post</a><br><br></td></tr>\n",
$myrow[2], $myrow[1], $myrow[3], $myrow[0], $myrow[0]);
}
echo "</table>\n";
?>
<?php
include ("dbConfig.php");
$result = mysql_query("SELECT * FROM comments WHERE post_id='$id'");
while ($myrow = mysql_fetch_row($result)) {
printf("%s <b>- %s</b><br><br>",
$myrow[3], $myrow[1], $myrow[0] );
}
?>