OpenConnection(); $dbSubsList = &new DbLibMySQL; $dbSubsList->OpenConnection(); $sqlCat = "SELECT id, name FROM category WHERE parentCatId is null ORDER BY name"; $dbListCat->Query($sqlCat); $dropDownList = ""; while($dbListCat->GetNextRecord()) { $dropDownList = $dropDownList . ''; $sqlSubsList = "select id, name from category where parentCatId = ". $dbListCat->GetField('id')." order by name"; $dbSubsList->Query($sqlSubsList); while($dbSubsList->GetNextRecord()) { $dropDownList = $dropDownList . ''; } } return $dropDownList; } ?>