|
Posted by Kimmo Laine on 03/10/07 19:44
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?
--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|