i'm not sure what the problem is...i'm guessing a logic error in my second query, but i just can't resolve this...everything is working...i just can't find the right combination for the logic...aargh...
this is what is happening -> http://www.radishbeet.com/newsloop3.php - click on "show" and "hide"...there should be comments in there for the top two messages...
i don't know how much of the code i should post...so i'll just post all of it...it's got a bunch of javascript in here...which allows the layer to hide and unhide...
any help would be much appreciated...i'm totally stumped at this point...jv
+++++++++ starts here ++++++++++++++
$query_news =mysql_query ("SELECT * FROM newsboard ORDER by nid DESC LIMIT 0,50" )or die("Unexpected error for MySQL database [3b]");
$row_news =mysql_fetch_array($query_news);
$query_comments =mysql_query("SELECT cdate,cauthor,cmessage,nid,cnewsid FROM comments,newsboard WHERE comments.cnewsid='$nid'ORDER by cdate DESC ")or die("Unexpected error for MySQL database [1b]");
$row_comments =mysql_fetch_array($query_comments);
?>
<html>
<head>
_<title>radishbeet.com</title>
<link rel="stylesheet" type="text/css" href="http://www.radishbeet.com/temp_style.css">
<style type="text/css">
<!--
____A:link {color:#ED1C24; font-weight: bold;}
__A:visited {color:#999999; font-weight: bold;}
__A:hover {color:#666666; font-weight: bold;}
-->
</style>
<script language="javascript">
<!--
function showComments(id){
____if (document.getElementById("comments"+id).style.display == ""){
_______show = "none";
__}
__else{
______show = "";
__}
__document.getElementById("comments"+id).style.display = show;
}
/ Check if at least one of the poll's proposals have been selected /
function checkPollSelection(id){
___submitVote=0;
__/ Get the number of proposals for the poll the user wants to vote for /
__proposals_total = eval("document.poolform"+id+".proposal"+id+".length;");
___/ Loop all proposals for the poll, and check if one as been checked /
__for (i=1; i<=proposals_total; i++){
______if(eval("document.poolform"+id+".proposal"+id+"["+(i-1)+"].checked;")){
___________submitVote=1;
______}
__}
__/ If the form can be submited /
__if (submitVote==1){
______eval("document.poolform"+id+".submit();");
______return true;
__}
__/ otherwise, send an alert message /
__else{
______alert("Please make your choise before submiting.");
__}
}
//-->
_</script>
</head>
<body bgcolor="#ffffff" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" link="#ED1C24" vlink="#999999" alink="#999999">
<?do{_?>
<table border="0" cellpadding="0" cellspacing="0" width="98%" bgcolor="#F2F2F2">
<tr>
<td bgcolor="#CCCCCC"> <a name="news<?echo $row_news['nid'];?>"></a> <table border="0" cellpadding="0" cellspacing="0">
___<tr>
____<td width="100%"> <table cellspacing="0" cellpadding="0" border="0">
________<tr>
__________<td class="verdana7white"><b> <?echo $row_news['ndate'];?> </b></td>
__________<td><img src="http://www.radishbeet.com/temp_spacer.gif" width=9 height=16 alt="" border="0"></td>
__________<td class="verdana7white"><b> <a href="mailto:jv@radishbeet.com" style="text-decoration: none;"><font color="#999999"><?echo $row_news['nauthor'];?></font></a></b> </td>
________</tr>
______</table></td>
____<td bgcolor="#ffffff"><img src="http://www.radishbeet.com/temp_point.gif" width=1 height=1 alt="" border="0"></td>
____<td class="verdana7grey" bgcolor="#9C9C9C" align="right"> <b><a href="news_post.html" target="nav" style="text-decoration: none;"><font color="#ffffff"></font></a><font color="#ffffff"><a href="javascript:void(0)" onclick="showComments(<?echo $row_news['nid'];?>)" style="text-decoration: none;"><font color="#ffffff">Show</font></a> </font></b></td>
__</tr>
</table></td>
</tr>
<tr>
<td><table border="0" cellpadding="6" cellspacing="0">
____<tr>
____<td class="verdana7black"><?echo $row_news['nmessage'];?></td>
__</tr>
_</table></td>
</tr>
__<!-- START COMMENTS -->
<tr>
<td bgcolor="#FCF9F3"><div id="comments<?echo $row_news['nid'];?>" style="display:none;"><table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr>
___<td colspan="2">
___________<?do{?>
_<table width="100%" border=0 cellspacing=7 cellpadding=0>
__<tr>
____<td width="100%" class="verdana7black"><span class="verdana7bordeau"><b><font color="#FF8060"><?echo $row_comments['cdate']?> | </font><?echo $row_comments['cauthor']?></b></span><br>
______<?echo $row_comments['cmessage']?><br> </td>
_____</tr>
_____<?}while($row_comments =mysql_fetch_array($query_comments));?>
</table></td>
</tr>
<tr bgcolor="#FAF1DF">
_<td class="verdana7bordeau" height="18" width="50%"> <a href="javascript:void(0)" onclick="showComments(<?echo $row_news['nid']?>)" style="text-decoration: none;"><font color="#FF8060">Hide</font></a> </td>
<td class="verdana7bordeau" height="18" width="50%" align="right"><a href="temp_post_comment.php?id=<?echo $row_news['nid']?>&referer=temp_news&page=1" target="nav" style="text-decoration: none;"><font color="#FF8060">Add
__comment</font></a> </td>
</tr>
</table>
_____</div></td>
</tr>
__<!-- END COMMENTS -->
<tr>
<td bgcolor="#ffffff"><img src="http://www.radishbeet.com/temp_point.gif" width=1 height=4 alt="" border="0"></td>
</tr>
</table>
<?}while($row_news =_mysql_fetch_array($query_news));?>
</body>
</html>