If the query returns nothing based on the criteria, then say - "Be the first to comment on this recipe!"
If the query does return something based on the criteria, then show the results. Sounds simple enough, but I don't think if ever been able to get one of these to work.
[PHP]<strong>Comment s:</strong><br><br>
<table width="95%" cellpadding="0" cellspacing="0" border="0">
<?php
include('includ es/dbcomment.php') ; //has database connect stuff
$result = mysql_query("SE LECT * FROM commenttable WHERE page_title = '$title' AND allow = 'yes'");
if (!$result)
{
echo "Be the first to comment on this recipe!";
}
else
{
while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
{
$commentname = stripslashes($r ow['commentname']);
$commentpost = nl2br(stripslas hes($row['commentpost']));
$commentpost = str_replace("<b r />","<br>",$comm entpost);
echo '
<tr>
<td>
<blockquote>
<!--Name:<br>-->
' . $commentpost . '<br>
<!--Comment:<br>-->
~ ' . $commentname . '
</blockquote>
</td></tr>
<tr><td>  ;</td></tr>
';
}
}
echo "</table>";[/PHP]
If the query does return something based on the criteria, then show the results. Sounds simple enough, but I don't think if ever been able to get one of these to work.
[PHP]<strong>Comment s:</strong><br><br>
<table width="95%" cellpadding="0" cellspacing="0" border="0">
<?php
include('includ es/dbcomment.php') ; //has database connect stuff
$result = mysql_query("SE LECT * FROM commenttable WHERE page_title = '$title' AND allow = 'yes'");
if (!$result)
{
echo "Be the first to comment on this recipe!";
}
else
{
while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC))
{
$commentname = stripslashes($r ow['commentname']);
$commentpost = nl2br(stripslas hes($row['commentpost']));
$commentpost = str_replace("<b r />","<br>",$comm entpost);
echo '
<tr>
<td>
<blockquote>
<!--Name:<br>-->
' . $commentpost . '<br>
<!--Comment:<br>-->
~ ' . $commentname . '
</blockquote>
</td></tr>
<tr><td>  ;</td></tr>
';
}
}
echo "</table>";[/PHP]
Comment