| 1 | <?php |
| 2 | //requiring main config file with path/database etc. constants |
| 3 | require('../config/config.inc'); |
| 4 | |
| 5 | //connecting to database and creating universal $db object |
| 6 | require(SYSTEM_ROOT.'/inc/log.inc'); |
| 7 | require(SYSTEM_ROOT.'/inc/database.inc'); |
| 8 | require(SYSTEM_ROOT.'/inc/nodes.inc'); |
| 9 | $db=new CLASS_DATABASE(); |
| 10 | |
| 11 | $set=$db->query("select distinct node_parent from nodes"); |
| 12 | while ($set->next()) { |
| 13 | $parent=$set->getString('node_parent'); |
| 14 | $countset=$db->query("select count(*) as pocet from nodes where node_parent='$parent'"); |
| 15 | $countset->next(); $pocet=$countset->getString('pocet'); |
| 16 | $db->query("update nodes set node_children_count='$pocet' where node_id='$parent'"); |
| 17 | } |
| 18 | |
| 19 | ?> |
| 20 | |