[COLOR=Navy] <?
$first_time=true;
$sql=$obj_db->query(“select * from categories where par_id=’0′”);
while ($rs_sql=$obj_db->fetch_array($sql)) {
echo “<tr><td class=’nav-td’><img src='”.THEME.”bullet.gif’> <a href='”.LINK.”category&cid=”.$rs_sql[‘id’].”‘ class=’nav-left’>”.$rs_sql[‘cat_name’].”</a></td></tr>”;
$cid=”;
if( isset($_GET[‘cid’]) ) {
$cid=$_GET[‘cid’];
$q=$obj_db->query(“select * from categories where par_id=’$cid'”);
while ($rs_q=$obj_db->fetch_array($q)) {
if($first_time) {
echo “<tr><td class=’nav-sub-td’>• <a href='”.LINK.”products&cid=”.$cid.”&sid=”.$rs_q[‘id’].”‘ class=’nav-sub-left’>”.$rs_q[‘cat_name’].”</a></td></tr>”;
}
}
$first_time=false;
}
}
?>[/COLOR]
what’s wrong with this code
it work’s all well for only 1 main-category and it’s sub categories
but if there i add 2nd category and subcategories of 2nd main category,
the sub-categories of 2nd main category also shows under the 1st main category
i just want to show the sub-categories under the relative main category