Hi all,
Can anyone see were i am going wrong?
When the user clicks on the
<A HREF=\"suburb_results.php?id=$sub\" target=_self>SUBURB</A>
link and the value passed for $sub = 0 ie. suburb_results.php?id=0, i want the suburb_results.php to say that there are no sububs for this entry.
i have made an attempt using an if statement but the message does not show.
Any ideas?
The following is a section of my details.php page:
$prev_cat = $row['CatParent'] ;
$sub = $row['suburb'] ;
if ($sub == ""){
$sub = 0;
}
echo "<BR><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
echo "<td width=\"80\"><P><A HREF=\"#top\"><IMG BORDER=\"0\" SRC=\"images/top.gif\" ALT=\"TOP OF PAGE\" width=\"19\" height=\"19\"></A>";
echo "<a href=\"javascript:void(0);\" onclick=\"history.back(); return(false);\" > <img src=\"images/back.gif\" alt=\"BACK\" border=0></a> </td>";
echo "<td><B>More information related to > <A HREF=\"melbourne.php?id=$prev_cat\" target=_self>TOPIC</A></B></td>";
echo "</tr></table>";
echo "<BR><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
echo "<td width=\"80\"></td>";
echo "<td><B>More information related to > <A HREF=\"suburb_results.php?id=$sub\" target=_self>SUBURB</A></B></td>";
echo "</tr></table>";
...and this is a section of the suburb_results.php page:
<?
include ("include/dbconnect.php");
$result = mysql_query("SELECT * FROM $table WHERE suburb = '$id' ORDER BY pref, CatName",$db);
while ($row = mysql_fetch_array($result)) {
if ( $row['suburb'] == "") {
echo "<TR>";
echo "<TD>There are know results for this entry</TD>";
echo "</TR>";
}
else if ( $row['description'] == "") {
echo "<TR>";
echo "<TD align=left vAlign=center width=\"29\"><a href=\"melbourne.php?id={$row['CatID']}\"><IMG align=center alt=\"LET'S GO MELBOURNE\" border=0 height=19 src=\"images/go.gif\" width=23></A>";
echo "</TD>";
echo "<TD align=left vAlign=center width=\"306\"><a href=\"melbourne.php?id={$row['CatID']}\">{$row['CatName']}</a></TD>";
echo "<TD align=left vAlign=center width=\"100\">< Click to view</TD>";
echo "</TR>";
} else {
echo "<TABLE cellPadding=2 cellSpacing=0 width=480>";
echo "<TBODY><TR>";
echo "<TD align=left vAlign=center width=\"29\"><a href=\"melbourne.php?id={$row['CatID']}\"><IMG align=center alt=\"LET'S GO MELBOURNE\" border=0 height=19 src=\"images/go.gif\" width=23></A>";
echo "</TD>";
echo "<TD align=left vAlign=center width=\"306\"><a href=\"melbourne.php?id={$row['CatID']}\">{$row['CatName']}</a></TD>";
echo "<TD align=left vAlign=center width=\"100\">< Click to view</TD>";
echo "</TR>";
echo "<TR>";
echo "<TD align=left bgColor=#f2f2f2 vAlign=center width=\"29\"></TD>";
echo "<TD align=left bgColor=#f2f2f2 vAlign=center width=\"306\" colspan=\"2\">{$row['description']}</TD>";
echo "</TR>";
}
}
?>