Re: Method for displaying Downline
| From: | David T-G | Date: | Mon, 02 Dec 2002 01:32:11 +0000 |
| Subject: | Re: Method for displaying Downline | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126659@lists.php.net to get a copy of this message | ||
Daren --
..and then Daren Cotter said...
%
% I need to display an entire downline (info about all
% members referred by another member). The query to
..
% The output I need is something like:
%
% 7
% 10 11
% 14 16 18 20
% 26 28 31 34 36 38 41 44
%
% Where 7 referred 10 and 11, 10 referred 14 and 16, 14
..
%
% I know some sort of looping (possibly recursion?)
That depends on how you have your tables structures. This is a perfect
opportunity for a binary tree, which is also easy to traverse. How is
the data stored?
% structure is needed, but I can't figure out how to
% display the output in tables as shown above.
See if you can live with something like
7
10 11
14 16 18 20
26 28 31 34 36 38 41 44
and then go from there. That's trivial.
If that won't work, then you can calculate the number of cells you'll
have to have running across the table as 2n+1, where n is the referral
depth, and then calculate the position based on what level and what path.
%
% Any help would be greatly appreciated!
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!