Hi,
I would like to display the comments in a database for each news_id. e.g.
1
Jimmy Jones - This is a comment - [delete]
2
Jimmy Jones - This is a comment - [delete]
Jimmy Jones - This is a comment - [delete]
3
Jimmy Jones - This is a comment - [delete]
Jimmy Jones - This is a comment - [delete]
Jimmy Jones - This is a comment - [delete]
Jimmy Jones - This is a comment - [delete]
etc.
I have something that looks sort of like it!...
1
Jimmy Jones
This comment should only appear on article 1
delete
2
tom
comment on article 2
delete
2
jimmy jones
article comment
delete
2
tommy h
its me!
delete
created from:
<?php
//display the current news comments
$query = "SELECT news_id, name, comment FROM news_comments ORDER BY news_id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
?>
<br/><br/>
<?php
while(list($news_id, $name, $comment) = mysql_fetch_array($result, MYSQL_NUM))
{
?>
<?php echo $news_id?><br/>
<?php echo $name;?> <br/>
<?php echo $comment;?><br/>
<a href="javascript:delArticle('<?php echo $id;?>','<?php echo $name;?>');">delete</a><br/>
<br/>
<br/>
<?php
} //finishes the above while loops
?>
How would I adapt the above to get my desired output? I think I might need a loop for each news_id, then a loop within that for each comment associated to that news_id? Any help much appreciated.
Kind regards.