query("select node_thread_vector,node_id from nodes"); while ($set->next()) { unset($pocet); $ancestor=$set->getString('node_id'); $vector=$set->getString('node_thread_vector'); $countset=$db->query("select count(*) as pocet from nodes where node_thread_vector like '$vector;$ancestor'"); $countset->next(); $pocet=$countset->getString('pocet'); $countset=$db->query("select count(*) as pocet from nodes where node_thread_vector like '$vector;$ancestor;%'"); $countset->next(); $pocet+=$countset->getString('pocet'); $db->query("update nodes set node_descendant_count='$pocet' where node_id='$ancestor'"); } ?>