Eric Butera wrote: > On Mon, Sep 29, 2008 at 11:21 AM, Richard Heyes <richard@xxxxxxx> wrote: >>> Use a tree structure (I assume it's a tree type menu that has already >>> been written and save yourself the hassle. The PEAR HTML_TreeMenu code >>> can Create a tree structure from a Tree object (my own tree class at >>> phpguru.org). >> Sorry, forgot to mention that said Tree object can create a tree >> structure from a flat MySQL result set using the familiar, >> id/parent_id, structure: >> >> >> -- >> Richard Heyes >> > > I would recommend using using a preorder tree traversal for storing > the data. It is a little different at first, but once you get the > idea it is pretty slick to work with. The main advantage is to build > the tree structure you only need one query as opposed to a recursive > algorithm. > > http://www.sitepoint.com/article/hierarchical-data-database/2/ > http://dev.mysql.com/tech-resources/articles/hierarchical-data.html I will keep the preorder tree traversal in mind, however, I am currently not worried about the number of queries. I just cannot figure out how to reuse the existing prepared statement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php