i've been working on my blog/thoughtrepository or awhile now, and i only have 1 more bug. I'm trying to get the "view.gif" to show up only when that $postid is found in the database. My problem is that its showing the view.gif EVERYTIME its found in the database. I've tried all different things....The part i'm having problems with is the nested while statement (the one with $row99) I want it to search the database for the current $postid, and if it finds it, print the picture, and then stop that nested while statement so the parent while statement and continue. Any ideas how i'd go about doing this?
$query = "SELECT today, entry, id FROM thought_posts order by id desc LIMIT 0,5";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
while($row=mysql_fetch_row($result))
{
$postid=$row[2];
print "<table border='1' cellpadding='6' cellspacing='5' style='border-collapse: collapse' bordercolor='#D4D4D4' width='565' id='AutoNumber1' bgcolor=#FFFFFF>";
print "<tr>";
print "<td bordercolorlight='#FFFFFF' bordercolordark='#FFFFFF'><p><b>$row[0]</b></td>";
print "<td bordercolorlight=#FFFFFF bordercolordark=#FFFFFF><p align='right'>";
$match=false;
mysql_select_db('xxx');
$query99 = 'SELECT postid FROM thought_reply';
$result99 = mysql_query($query99) or die('Query failed : ' . mysql_error());
while($row99=mysql_fetch_row($result99))
{
if($postid==$row99[0])
{
$match=true;
}
if($match)
{
print "<a href=\"javascript:openWindow('notes.php?postid=$postid','notes','370','300','1','1')\" style=\"text-decoration: none\"'><img src='img/view.gif' border='0'></a>";
$match=false;
}
else
{
}
}
print "<a href=\"javascript:openWindow('write.php?postid=$postid','notes','370','300','1','1')\" style=\"text-decoration: none\"'><img src='img/write.gif' border='0'></a><a href='#top'><img border='0' src='img/up.gif'></a></p></td>";
print "</tr>";
print "<tr>";
print "<td colspan=2 bordercolorlight=#FFFFFF bordercolordark=#FFFFFF><p>$row[1]</td>";
print "</tr>";
print "</table>";
print "<br>";
}