Hi Guys,
Can anyone see where the problem is?
I can't get my bread crumb navigation to function properly.
At the moment it produces the correct "Home" link and the current position within the bread crumb but not the information (links) inbetween.
Any ideas?
Here is my index.php page:
<?
include ("admin/include/dbconnect.php");
$query = "SELECT CatID, CatParent, CatName FROM $table WHERE CatParent='1'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo "<TR><TD WIDTH=\"100%\"><IMG BORDER=\"0\" SRC=\"images/arrow_W.gif\" width=\"6\" height=\"9\">";
echo "<A HREF=\"results.php?id={$row['CatID']}\">{$row['CatName']}</A></TD></TR>";
}
?>
Here is a section of my results.php page:
<?
if(!$id) $id = 1;
include ("admin/include/dbconnect.php");
<?
function getParentID($childID){
$row = mysql_fetch_row(mysql_query("SELECT CatParent FROM $table WHERE CatID = $childID ORDER BY CatID"));
return $row[0];
}
if($id > 1){
$nextID = $id;
do{
$nextID = $ar[$count++] = getParentID($nextID);
} while($nextID > 1);
$ar = array_reverse($ar);
foreach($ar as $parent){
if($parent > 1){
$row = mysql_fetch_row(mysql_query("SELECT CatName FROM $table WHERE CatID = $parent"));
echo " <IMG border=0 height=9 src=\"images/arrow_W.gif\" width=6> <a href=\"results1.php?id=$parent\">$row[0]</a>";
}
else {
echo "<table width=\"710\" border=\"0\" bgcolor=\"#ffffff\"><tr><td bgcolor=\"#ffffff\" width=\"598\"><a href=\"results.php?id=$id\">Home</a>";
}
}
$row = mysql_fetch_row(mysql_query("SELECT CatName FROM $table WHERE CatID = $id"));
echo " <IMG border=0 height=9 src=\"images/arrow_W.gif\" width=6> <b>$row[0]</b></td></tr></table>";
}
?>
HTML stuff here.........
<?
$query = "SELECT CatID, CatParent, CatName FROM $table WHERE CatParent='$id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo "<TR><TD WIDTH=\"100%\"><IMG BORDER=\"0\" SRC=\"images/arrow_W.gif\" width=\"6\" height=\"9\">";
echo "<A HREF=\"results1.php?id={$row['CatID']}&new_id=$id\">{$row['CatName']}</A></TD></TR>";
}
?>
and finally the results1.php page:
<?
if(!$id) $id = 1;
include ("admin/include/dbconnect.php");
function getParentID($childID){
$row = mysql_fetch_row(mysql_query("SELECT CatParent FROM $table WHERE CatID = $childID ORDER BY CatID"));
return $row[0];
}
if($id > 1){
$nextID = $id;
do{
$nextID = $ar[$count++] = getParentID($nextID);
} while($nextID > 1);
$ar = array_reverse($ar);
foreach($ar as $parent){
if($parent > 1){
$row = mysql_fetch_row(mysql_query("SELECT CatName FROM $table WHERE CatID = $parent"));
echo " <IMG border=0 height=9 src=\"images/arrow_W.gif\" width=6> <a href=\"results1.php?id=$parent\">$row[0]</a>";
}
else {
echo "<table width=\"710\" border=\"0\" bgcolor=\"#ffffff\"><tr><td bgcolor=\"#ffffff\" width=\"598\"><a href=\"results.php?id=$new_id\">Home</a>";
}
}
$row = mysql_fetch_row(mysql_query("SELECT CatName FROM $table WHERE CatID = $id"));
echo " <IMG border=0 height=9 src=\"images/arrow_W.gif\" width=6> <b>$row[0]</b></td></tr></table>";
}
?>
<?
$query = "SELECT CatID, CatParent, CatName FROM $table WHERE CatParent='$new_id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo "<TR><TD WIDTH=\"100%\"><IMG BORDER=\"0\" SRC=\"images/arrow_W.gif\" width=\"6\" height=\"9\">";
echo "<A HREF=\"results1.php?id={$row['CatID']}&new_id=$new_id\">{$row['CatName']}</A></TD></TR>";
}
?>
Other HTML and php stuff below.........