ok this may help a bit  (I think)

you want something like this:


First you got to have your tables like this.

ID, title, PID (parrent id)

ok use
function rec_tree($pid)
//some connect stuff here

$sql = "SELECT * FROM mymenu WHERE PID = '$pid' "

// some database get here
// and print the output
// then use the id and call your self

first you start with the $pid = 0

and you get
and then for each time you write out a line (data)
you call the same function that you made with pid = the lines id

make sure you use some DEAD LOCK detection like IF or a counter or something
so you don't get an infi.  loop    :)

"-{ Rene Brehmer }-" <[EMAIL PROTECTED]> wrote in message
> At 20:03 30-03-2004, you wrote:
> >Well,
> >
> >I did a similar system for my CMS sollution. If I understand you
> >correct you want to sort the main branch, keeping the subs.
> Not really ... I want to be able to expand the current sub to the current
> sub's level, list the subfolders contained within the current sub, and
> it not expand any other subs of the root... and then still list the entire
> root folder structure before and after ... my main problem is really
> finding an easy way to locate the root folder to start branching, with
> using as few queries as possible ...
> The sorting is really completely irrelevant in this connection, it's more
> matter of locating the right branches to expand...
> I've not looked at it since I did the first test ... been busy with other
> things ... but was considering doing a series of reverse recursive SQL
> pulls, where I start with the requested folder's ID, put that in an array,
> then find the parent of that folder, put that into the same array, find
> parent of that folder, put that ID into the array, and keep doing that
> I reach the root folder. Then load the root folders and print them out
> I reach the root folder in the array, and then start branching out from
> there, listing the contents of the subfolders, and branching out the ones
> in the array...
> The reason I don't like to keep the level of the folder in the database is
> that I want to be able to move any and all folders around across levels in
> the database ... and keep their subfolders attached ...
> Sofar I'm a bit blank in regards to this .... especially because I'm doing
> it to figure out how to do it, but don't really have anything specific I
> want to use it for yet, that requires more than 2 level of folders...
> Rene
> -- 
> Rene Brehmer
> aka Metalbunny
> ~ If you don't like what I have to say ... don't read it ~
> http://metalbunny.net/
> References, tools, and other useful stuff...
> Check out the new Metalbunny forums @ http://forums.metalbunny.net/

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

Reply via email to