[thelist] How to construct this query?

Burhan Khalid burhankhalid at members.evolt.org
Tue Nov 5 06:26:01 CST 2002


Hello List,

      Yesterday I happened to be volunteered for a discussion on a
      project one of my colleagues is undertaking. He is writing a
      forum-like script in PHP that has support for threaded
      discussions.

      The problem that he was facing was figuring out how to query the
      database to get information on a messages' family (ie, what's
      its parent, does it have any children, are the children parents,
      etc.)

      I noticed that he didn't have a unique ID that distinguised each
      thread -- so I suggested he add that because the thread starting
      message will be the root (head) node. Now the problem becomes
      how do you construct a query (and the table relationships), so
      that you know how deep the tree goes?

      At first, I thought his problem would be easily solved if the
      project was converted over to XML, but he is stuck with a
      database. Any ideas on how we can construct the tables to make
      this happen? He is going to get back with me tomorrow and I want
      to have something constructive to add -- besides, this is
      tickling my brain and I can't seem to get anything else done.

--
*---------------*
| Burhan Khalid |
*---------------*-------------------------------*
| Email : burhankhalid[at]members.evolt.org     |
| Web   : members.evolt.org/burhankhalid        |
| ICQ   : 6016166                               |
| AIM   : digitz0819                            |
| MSN   : burhankh[at]hotmail.com               |
| Yahoo : burhan_khalid                         |
*-----------------------------------------------*
| mushkil hai zabas kalaam mera ai dil          |
| sun sun ke ise suKhan_varaa.N-e-kaamil        |
| aasaan kahane kii karate hai.n faramaaish     |
| goim mushkil vagaranaa goim mushkil           |
|-----------------------------------------------|
| Too hard to grasp is my verse, O heart!       |
| Hearing it, the connoisseurs of art           |
| For a simpler style do ask                    |
| Difficult, if I write, difficult, if I do not |
*-----------------------------------------------*




More information about the thelist mailing list