Re: PHP / MySQL Threaded Discussion: One Query
From: Jochen Daum (jochen.daum_at_cabletalk.co.nz)
Date: 06/28/04
- Next message: Bob Bedford: "Re: array of...array...."
- Previous message: Tim Van Wassenhove: "Re: readdir is not reading the full directory, why?"
- In reply to: ensnare: "PHP / MySQL Threaded Discussion: One Query"
- Next in thread: Tim Van Wassenhove: "Re: PHP / MySQL Threaded Discussion: One Query"
- Reply: Tim Van Wassenhove: "Re: PHP / MySQL Threaded Discussion: One Query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Jun 2004 08:44:12 +1200
Hi,
On 27 Jun 2004 23:43:23 -0700, ensnare@gmail.com (ensnare) wrote:
>I'm attempting to create a threaded comment system involving PHP /
>MySQL. Currently, I have a table called comments which looks like:
>
>Table Comments: (comment_id, comment_root_id, comment_parent_id, text,
>datetime_created).
>
>Most of the tutorials that I've found online discuss how to thread the
>results from the database with recursive query calls. This is all to
>the good; however, with lengthy discussion, this solution becomes slow
>and unacceptable.
Its a bit long to explain out of the box, but look up "nested set
model", which is well described in books of Joe Celko. It needs only
one self referencing query for a whole tree (discussion)
HTH, Jochen
-- Jochen Daum - Cabletalk Group Ltd. PHP DB Edit Toolkit -- PHP scripts for building database editing interfaces. http://sourceforge.net/projects/phpdbedittk/
- Next message: Bob Bedford: "Re: array of...array...."
- Previous message: Tim Van Wassenhove: "Re: readdir is not reading the full directory, why?"
- In reply to: ensnare: "PHP / MySQL Threaded Discussion: One Query"
- Next in thread: Tim Van Wassenhove: "Re: PHP / MySQL Threaded Discussion: One Query"
- Reply: Tim Van Wassenhove: "Re: PHP / MySQL Threaded Discussion: One Query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|