Tony Crockford <mailto:[EMAIL PROTECTED]>
    on Tuesday, July 29, 2003 10:23 AM said:

> I have a mySQL database containing items that are categorised four
> levels deep.

[snip]

> can anyone point me to a tutorial that would help me switch from
> nested select statements to something more elegant?

Try this article: http://www.sitepoint.com/article/1105/1

It details a method called Modified Preorder Tree Traversal. It's a
fairly different way of thinking about hierarchical data when compared
to the parent/child model. But once you understand what's happening it's
quite elegant and fast.

Using this method will also allow you to use more than 4 levels (if your
heart so desires) of categorisation without having insanely complex sql
select statements.

Let me know if you get stuck on the concept (although the author does a
good job of explaining it) and I'll see if I can help.


Chris.

p.s. While going through this article, I found that it helped immensely
my understanding of the concept when I took my own data and created the
tree by hand on a piece of paper, as opposed to just following his
diagram with your eye. Creating your own tree with your own data on a
piece of paper really helps you understand how things get
ordered/numbered.

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

Reply via email to