Just to give an idea what I'm talking about -- IF I understood the what you wanted to have for logic flow on that last post of your code:
Code:
echo '
<div id="leftCol">';
if (isset($selcat3)) {
$result=mysql_query('
SELECT subcategory2id,name
FROM products
WHERE reference='.$selcat3
);
echo '
<ul class="selCat">';
while ($row=mysql_fetch_array($result)) echo '
<li>
<a href="subcategory1id.php?subcategory1=',$row['subcategory2id'],'">
',$row['name'],'
</a>
</li>';
echo '
</ul>
<ul class="getSubCat2">';
$result=mysql_query('
SELECT subcategory2id,name
FROM products
WHERE subcategoryid = '.$_GET['subcategory2']
);
while ($row=mysql_fetch_array($result)) echo '
<li>
<a href="categorylist.php?category=',$row['subcategory2id'],'">
',$row['name'],'
</a>
</li>';
echo '
</ul>';
unset($cats[$selcat3]); //Gets rid of it for later.
}
echo '
<ul class="cats">';
foreach($cats AS $key => $cat) {
echo '
<li><a href="categoryview.php?category=',$key,'">',$cat,'</a></li>';
}
echo '
</ul>
<!-- #leftCol --></div>';
Is about how I'd be coding that... give or take.
You'll notice I gave them classes so they can be targeted as unique -- if they are all getting the same class, they probably do NOT need a class and should be targeted off the parent... likewise UL is a perfectly good block level container, so there should be no reason for the extra DIV around each.
Bookmarks