dear, I am also having the same problem, but can't get your solution

what does it mean by: $row['children'] and $category['id']

are they database (table) column ???