I've got a little out of my depth with this one, so I wonder if anyone can help!
I've go the following code:
PHP:
<?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><br><br></td></tr>\n",
$myrow[2], $myrow[1], $myrow[3], $myrow[0]);
}
echo "</table>\n";
?>
The code looks at my message post table and pulls out all of the results (http://69.73.155.48/index2.php).
All of the above works fine, and I have now created a second table called "comments" and created the input forms for the users. Again, this works fine up till this point.
The problem I am having is that I want to post all of the comments below the relevant posts on the main page. I just cannot get it to work. I've tried nesting another while loop into the code but I keep getting errors. When the user posts a comment it is stored in the comment table with the userID number and the message which it is relevent to.
If anyone can help I would be really greatful!