I have the following code to create category and subcategories from a database
function displayChild($parent)
{
include 'connect.php';
$parentid=$parent;
$catSql='select* from categories where parentid='.$parentid.'';
$result=$con->query($catSql);
echo '<div><ul class='.'ul'.$parentid.'>';
while ($rows=$result->fetch_assoc())
{
echo '<li><a href="#">'.mb_strtoupper($rows['catName']).'</a></li>';
displayChild($rows['catId']);
}
echo '</ul></div>';
}
displayChild('0');
The CSS bits should be as follows
@charset "utf-8";
.ul0{}
.ul1{}
.ul2{}
.
.
.
.uln{}
since the first tag appears outside the while loop it forms a really weird list when i reference it.putting it inside the while() loop is not an option either. please help