Re: Reuse MySQL prepared statement

From: Date: Mon, 29 Sep 2008 15:41:45 +0000
Subject: Re: Reuse MySQL prepared statement
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-281104@lists.php.net to get a copy of this message
On Mon, Sep 29, 2008 at 11:21 AM, Richard Heyes <richard@php.net> 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 > > HTML5 Graphing for FF, Chrome, Opera and Safari: > http://www.phpguru.org/RGraph > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > 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

« previous php.general (#281104) next »