rendered paste bodyfunction count_kids($post_id) {
global $blog_table;
echo "post_id being passed to functions is: $post_id";
$kid_query = "SELECT post_id FROM $blog_table WHERE parent_id = $post_id";
$post_kids = mysql_query($kid_query);
$post_kids_array = mysql_fetch_array($post_kids, MYSQL_ASSOC);
$kids_num = mysql_numrows($post_kids);
echo "<pre>";
print_r($post_kids_array);
echo "</pre>";
if ($kids_num > 0) {
$kid_id[] = array();
for ($i=0; $i<$kids_num; $i++) {
$kid_id[$i] = mysql_result($post_kids, $i, "post_id");
echo "<br />=-=-=-=-=-=-= This is the post_id: $kid_id[$i]";
foreach($kid_id as $child) {
echo "<br />--- callings function again...";
echo "<br /><br />Loop count: $i<br />kid_id = $kid_id[$i]<br />number of kids so far: $number_of_kids<br /><br />";
$number_of_kids = $number_of_kids + 1;
count_kids($child);
}
}
}
else {
$number_of_kids = 0;
return (0);
}