here's what my script does for that on my news :
[code:1:9f68712c98] $result = mysql_query("SELECT * FROM news ORDER BY news_id DESC LIMIT 10");
//Make table & display data
//Put data in array also...
while($myrow=mysql_fetch_array($result)){
####here you go ... this is where the query is
$result2=mysql_query("SELECT * FROM comments WHERE news_id='$myrow[news_id]'");
$num_comments=mysql_num_rows($result2);
####I put the stuff in a variable
####To put in news below!
echo"
<table align=\"center\" border=\"0\" cellpadding=\"4\" style=\"border-collapse: collapse\"><tr><td><table align=\"center\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:
collapse\" width=\"96%\" id=\"AutoNumber8\" bordercolor=\"#FFFF00\"> <tr><td>$myrow[news_title] :: Posted by $myrow[news_author]</td></tr><tr><td>$myrow[news_content]< tr><td><a
href=\"news.php?cmd=post&id=$myrow[news_i d]\">Post a comment</a> :: <a
href=\"news.php?cmd=read&id=$myrow[news_i d]\">Read Comments</a> :: ($num_comments) Comments</td></tr></td></tr><tr><td></tr></td></td></tr></td></tr></table></table>";
}[/code:1:9f68712c98]
thats' a lil chunk of my news.php ... actualy not even close to little more like microscopic chunk lmao . but anways it works out fine...to see it in action www.wargamershq.com
|