I am pulling record set from a database. If there are no results, it should say there were no results. Why isn't this working?
if(!$link = mysql_connect "Host", "UserName", "Password"))
die("No Connect to DB");
if(!mysql_select_db($which_db,$link))
die("No Select DB");
$query = "SELECT * from tblCourses where State = '$state' and Member = 'Yes' order by Course_Name";
$result = mysql_query($query,$link);
if($result)
{
while ($r=mysql_fetch_array ($result) )
{
$Course=$r["Course_Name"];
$Phone=$r["Phone"];
$City=$r["City"];
$State=$r["State"];
$Zip=$r["ZipCode"];
$Featured=$r["Member"];
$URL=$r["URL"];
$color=$counter++%2?'#669966':'#CECB9C';
$font=$fontcounter++%2?'#FFFFFF':'#000000';
echo " <tr><td bgcolor='$color' width='30%' valign='top' align='left'><font color='$font'><a href='$URL.asp' class='tablelinks'><B>$Course</B></a></font></td>";
echo " <td bgcolor='$color' width='30%' valign='top' align='left'><font color='$font'>$City, $State $Zip</font></td>";
echo " <td bgcolor='$color' width='30%' valign='top' align='left'><font color='$font'>$Phone</font></td></tr>";
}
}
else
{
die("<tr><td bgcolor='#FFFFFF' colspan='3' align='center'><B>No Results Were Found</B></td></tr>");
}
?>