Forum Moderators: coopster
mysql_select_db($db_name, $dbh);
$topquery=mysql_query("SELECT sectionID,sectionName,sectionDescription,topSection,rootSection FROM sections WHERE topSection=0 AND sectionID!='37' ORDER BY sectionOrder") or print(mysql_error());
while ($top = mysql_fetch_array($topquery)) {
$catname = $top['sectionName'];
$catpid = $top['sectionID'];
$cat2 = $top['topSection'];
$url = $top['sectionID'];
$rootSection=$top['rootSection'];
if($rootSection>=1) {
echo "<h4><a href=\"products.php?cat=$url\">$catname</a><h4>";
}else{
$sql="SELECT topSection from sections WHERE sectionID= '" . $cat . "' AND sectionID!='37'";
$query = @mysql_query($sql) or die('<p>Error Fetching Details: ' . mysql_error() . '</p>');
$result = @mysql_fetch_array($query);
@mysql_free_result($query);
$topSection = $result['topSection'];
if($topSection=$url)
print "<h4><a href=\"categories.php?cat=$url\">$catname</a></h4>";
if(@$_GET['nav']=="")
$cat = @$_GET['cat'];
else
$cat = @$_GET['nav'];