[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    [PHP] Recursion with database tables
From:       Jono Bacon <jonobacon_lists () yahoo ! co ! uk>
Date:       2003-02-19 12:41:58
[Download RAW message or body]

Hi all,

I am still pretty new to PHP, but I was chatting to a friend the other 
day and he put some thoughts into my head about how tables are laid out 
and processed.

At the moment I have three tables: Topic, Message, Comment. A topic has 
messages and each message can have comments. I have set this up with a 
table each and a field for the id of the parent (e.g. a comment will 
have the id of the message that it refers to).

My mate said to me that I should really put all of this in one big table 
with a parent and child field. He said that my code should then figure 
out what is the child of what and how it is displayed.

I have two questions about this:

    1. First, is this idea of using one big table with parent/child 
fields better than my seperate table approach?

    2. Secondly, how would I write the logic for the single table approach.

Any help or advice or links to documentation would be great.

Cheers,

    Jono




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic