| 1 | <? |
| 2 | ini_set("include_path","/home/hromi1/kyberia/inc:/home/hromi1/kyberia/boxiky/:/home/hromi1/kyberia/config/"); |
| 3 | include_once("kyberia.inc"); |
| 4 | include_once("configdb.inc"); |
| 5 | $database=new CLASS_KYBERIA(); |
| 6 | function getParent($category) { |
| 7 | global $pole; |
| 8 | global $database; |
| 9 | // echo "select category_parent from category where category_id='$category' and category_parent!=0"; |
| 10 | $set=$database->query("select category_parent from category where category_id='$category' and category_parent!=0"); |
| 11 | if ($set->next()) { |
| 12 | // $set->next(); |
| 13 | $pole[]=$set->getString('category_parent'); |
| 14 | |
| 15 | getParent($set->getString('category_parent')); |
| 16 | |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | |
| 21 | |
| 22 | $database=new CLASS_KYBERIA(); |
| 23 | $q="select * from category"; |
| 24 | $set=$database->query($q); |
| 25 | //getParent(67); |
| 26 | //print_r($pole); |
| 27 | |
| 28 | while($set->next()) { |
| 29 | $pole[]=$set->getString('category_id'); |
| 30 | getParent($set->getString('category_id')); |
| 31 | print_r($pole); |
| 32 | $pole=array_reverse($pole); |
| 33 | echo "<br>".$set->getString('category_id'); |
| 34 | foreach($pole as $key => $value) { |
| 35 | $param.="$value;"; |
| 36 | } |
| 37 | echo "::$param"; |
| 38 | $param=addslashes($param); |
| 39 | $database->update("update category set category_tree='$param' where category_id='".$set->getString('category_id')."'"); |
| 40 | unset ($param); |
| 41 | unset($pole); |
| 42 | |
| 43 | |
| 44 | } |
| 45 | |
| 46 | ?> |