Re: Reuse MySQL prepared statement

From: Date: Mon, 29 Sep 2008 16:20:26 +0000
Subject: Re: Reuse MySQL prepared statement
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-281111@lists.php.net to get a copy of this message
Eric Butera wrote: > 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 >> > > 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.

« previous php.general (#281111) next »