Re: Recursive Threading
| From: | Philip Hallstrom | Date: | Thu, 03 Jan 2002 23:02:05 +0000 |
| Subject: | Re: Recursive Threading | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79385@lists.php.net to get a copy of this message | ||
There's a couple of ways you could do this...
- search zend.com and other PHP sites for something similar :)
- pick up Joe Celko's "SQL for Smarties" which talks about building trees
and graphs in SQL (which is what this is)... this can get kind of
complicated though.
or...
- modify your table so that every row has a threadID as well as a
parentID.
- change your query so that you select all the rows that have a given
threadID.
- use something like the code here for "sorting".
http://stuff.adhesivemedia.com/php/heirarchial-sorting.php
good luck!
On Thu, 3 Jan 2002, Jonathan Chum wrote:
> I'm using recursive threading for a simple thread board script, but the
> problem is the # of queries needed to execute. That is, once given the main
> thread post, it'll have to find all the posts where the parentID matches the
> current ID, then requery again for each of the post.
>
> So I'm trying to discover a way to limit the amount of querying, possibly
> there is some type of algo I don't know about or a method using arrays. Any
> wisdom on this is greatly appreciated.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>