Echo error line
Posted: Thu Apr 10, 2008 4:43 pm
How can I get this piece of code to show the error line at the bottom of the code fragment when the conditions of the SELECT query are not met? I've tried various combinations between $result and $row and nothing seems to work...
Any help would be much appreciated!! Thanks! 
Code: Select all
<?
if ($_POST['propertyType']=="Flat" && $_POST['postcode']){
$result = mysql_query("SELECT * FROM property WHERE propertyType = 'Flat' AND propertyArea = '$_POST[postcode]' ORDER BY 'propertyID' ASC");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
<tr>
<td>
<font face="Arial" color="#0B3A62">
<?
// Echo them out
echo "<a href=\"searchprocess.php?id=$row[propertyID]\">$row[propertyType]". ", £". $row[propertyPrice];
}
}
?>
</a>
</font>
</tr>
</td>
<br>
<br>
<p>
<font face="Arial" color="#0B3A62">
<?
// If there are no records returned, tell the user
if(empty($row)){
echo "There are no records returned for your search query.";
}
?>