<?php
while($r=mysql_fetch_array($result)) {
$parents = $r['parents'];
$childCount = $r['childCount'];
$childsName = $r['childsName'];
foreach ( $parent as $childsParent {
foreach ( $childCount as $countChildren ) {
foreach ( $childsName as $child=> $name ) {
echo "$childsParent has $countChildren kids.";
echo "$child : $name";
}
}
}
}
?>
I don't really know your db structure or anything like that and I just tossed the above example up to give you an idea. I have not tested it nor do I know if it would work like that. But i've used a several foreach loops within a while loop to do about the same thing you're wanting to do.
What I was trying to say in the above is this: For each of the parents, (foreach()) loop through, count their children, then display that parents childrens names.
I hope this makes sense to ya... as i'm somewhat loaded on tylenol p.m and very drousy right now. heh.