|
Posted by rdw on 03/11/07 08:02
Kimmo Laine wrote:
> Milan Krejci kirjoitti:
>> the thing is that descentant branches i dont want to expand do expand.
>> $id variable contains an array of branches i want the program to go
>> through (alcohol's id -> beer id etc)
>>
>> function tree_list($parent, $level,$id) {
>> // retrieve all children of $parent
>>
>> $result = mysql_query('SELECT cname,cid FROM kategorie '.
>> 'WHERE parent="'.$parent.'";');
>> while ($row = mysql_fetch_array($result)) {
>> echo str_repeat(' ',$level).$row['cname']."<br/>\n";
>>
>> if ($row['cid']==$id[$level])
>> $this->tree_vypis($row['cid'], $level+1);
>> }
>> }
>
> Sorry but I don't understand what the problem is. There seems to be some
> sort of recursive hierarchy tree structure involved but that's all I
> get. Also it would be nice to know what the method tree_vypis does. Try
> reformatting the question. What exactly is the _problem_?
>
> Btw: A noob using classes and recursion? A case of cut'n'paste coding?
i may have been using linux and php for a couple of years. when i cut n
pasted the code i realized it wasnt almost different from what i wrote
>
the program expands tree from a typical (category name, category id and
category parent) mysql db. the trouble is that i get
Alkohol
Beer
f
e
Likery
Bozkov
Citrus
Fernet
Vodka
Chipsy
Noviny
when i wanted the Beer branch stay collapsed. i wanted only to list
Likery->Bozkov.
Navigation:
[Reply to this message]
|