To see what I'm working with, go here:

http://www.melancholy.org/test_tree.php

You may want to copy the source and the (mySQL) db structure and 
set it up on your system there to test it out.  Though, if you don't want 
to do that, I show the output at the very bottom of the page.

One note: I took out all the code that connects to the db and what not.  
It's not really relevant and it has logins, etc. 

Now, what I'm trying to do is build a tree based on the data in the DB.  
It's working relatively ok if I uncomment the code that is on line 48 and 
comment out line 49.  However, what I really want to do is build a fully 
associative array doing this and now an array that has string keys but 
then, those arrays having numeric keys (copy and run this code 
un/commenting the lines above and you'll see what I mean).

What is going wrong is that for whatever reason (and I can't see why, it 
should be working and I'm getting ready to become certifiable any time 
now), though it works at the beginning, what is getting passed to 
getParentNodes() on line 55 eventually stops being an array.  What's 
getting passed is the word "SET" (something I'm just putting in there.  I'm 
not really interested in the value, just the keys of the various arrays).  Why 
is that?  $currentBranch["$nodeName"] should *always* be an array in that 
section of the code...

if you define

$array["this"]["that"] = 1;

$array["this"] is an array.  However, in my code, the array that I'm using
is not being treated as such and I have no idea why.

One other thing of note about the data from the DB: I realize that "this"
and "briggs" are looping back on one another.  The code that I have at
lines 45 and 47 keep it from infinitely looping.

Please, can someone offer any explanation as to why I'm getting the
problem that I am?

Chris



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

Reply via email to