My program works great - it returns records when they are present, and nothing when, well there is nothing to return:
BUT -I want to return a message: "No records found" when there is nothing there - am I using the right statement or do I need a if/else loop instead... and if so how do I do that. Here is the code:
$result = mysql_query("SELECT FirstName,LastName,StreetAddress,City,State,Zip,Phone,Fax,Email,Website,PractitionerType,Specialty FROM Practitioners WHERE State='$State'");
echo "<table width='95%' border='0' cellspacing='2' cellpadding='2' class='body'>
<tr>
<td>";
while ($row = mysql_fetch_array($result))
{
echo $row[FirstName];
echo " ".$row[LastName]."<br>";
echo $row[StreetAddress]."<br>";
echo $row[City].", ";
echo $row[State].". ";
echo $row[Zip]."<br>";
echo $row[Phone]. " - ";
echo "Fax: ". $row[Fax] . "<br>";
echo "<a href=\"mailto:".$row[Email]."\">" . $row[Email] . "</a><br>";
echo "<a href=\"http://". $row[Website] . "\">" . $row[Website] . "</a><br>";
echo "Type of Practitioner: " . $row[PractitionerType] . "<br>";
echo "Specialty: " . $row[Specialty] . "<br>";
echo "<hr>";
echo "</td>";
echo "</tr>";
}
echo "</table>";[/COLOR]