Hi all,
Here is my example: http://www.onlymelbourne.com.au/melb_index.php
What i am wanting to do is place some text at the top of the opening page, and only the opening page. At the moment if you were to click the Shopping link the text would show on the next page.
This is my script so far:
<?
if(!$id) $id = 1;
$link = mysql_connect('localhost', '', '');
mysql_select_db('melb');
?>
<body>
<?
//echo "<a href=\"melb_index.php\">Home</a>";
?>
<?
function getParentID($childID){
$row = mysql_fetch_row(mysql_query("SELECT CatParent FROM categories 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 categories WHERE CatID = $parent"));
echo "<a href=\"melb_index.php\">Home</a> - <a href=\"melb_index.php?id=$parent\">$row[0]</a>";
}
}
$row = mysql_fetch_row(mysql_query("SELECT CatName FROM categories WHERE CatID = $id"));
echo "<a href=\"melb_index.php\">Home</a> - $row[0]";
//echo "<a href=\"melb_index.php?id=$id\">$row[0]</a>";
}
echo "<BR><BR>";
$row = mysql_fetch_row(mysql_query("SELECT COUNT() FROM categories WHERE CatParent = $id"));
if($row[0] > 0){
$result = mysql_query("SELECT FROM categories WHERE CatParent = $id ORDER BY CatID");
while($row = mysql_fetch_array($result)){
echo "<img height=\"11\" src=\"Melbourne, Victoria_files/arrow.gif\"> <a href=\"melb_index.php?id={$row['CatID']}\">{$row['CatName']}</a><br>\n";
}
} else {
echo '<b>Info:</b><blockquote>';
$row = mysql_fetch_row(mysql_query("SELECT info FROM categories WHERE CatID = $id"));
echo $row[0];
echo '</blockquote>';
}
?>
</body>