I have the following problem. I want to make a two-dimensions menu (user clicks on a category and under it appears list of subcategories of this category). The problem is that I can't display the subcategories right under the selected category - it displays under the whole block of categories. How can I solve the problem?
Here is my code:
Thanks a lot.PHP Code:function ShowCats() {
$cat=mysql_query("SELECT * FROM category ORDER by orderlist") or die ("Cant: " . mysql_error());
while($rows=mysql_fetch_array($cat)) {
echo "<a class='categorie' href='index.php?go=products&catid=$rows[id]'>$rows[name]</a>";
}
if(isset($catid)) {
$subcat=mysql_query("SELECT * FROM subcategory WHERE category=$catid ORDER BY orderlist");
while($rows=mysql_fetch_array($subcat)) {
echo $rows['name'];
}
}


Reply With Quote
Bookmarks