Re: Nested database loops and completing an unordered list....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And see also this, which focuses only on the database part of the problem:
http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

On Thu, Mar 1, 2012 at 5:08 PM, FeIn <acid24@xxxxxxxxx> wrote:

> I don't how how you keep your data in your database but there is no need
> to issues that many queries to retrieve your data. From what I understand
> the data you want to display is hierarchical. Here's an article that will
> hopefully point you to a solution (there are more out there, some better
> than other, google mysql hierchical data or database hierarchical data).
> The article I was talking about is here:
> http://www.sitepoint.com/hierarchical-data-database/
>
>
>
>
> On Thu, Mar 1, 2012 at 4:29 PM, Jay Blanchard <
> jay.blanchard@xxxxxxxxxxxxxxxxxxx> wrote:
>
>> Good morning PHP groupies!
>>
>> I am working on this tool that will ultimately display a collapsible org
>> chart. The org chart is based on a nested unordered list and that is the
>> heart of my question.
>>
>> The NUL(nested unordered list) is based on a set of database queries -
>> sometimes as many as 14 queries. Each query relies on data returned by all
>> of the the queries before it. So what I am doing right now is this -
>>
>> query generates a list item
>>    while this list item get the next level dependent upon this item
>>        query generates this list item
>>                while this list item get the next level dependent on each
>> list item above
>>
>> ...and so on. (I have written about this before and thought I had it
>> solved, but alas, that is not the case.) The result needs to be something
>> like this:
>>
>> <ul>
>> <li>level a
>> <ul>
>> <li>level b</li> // has no children
>> <li>level b
>> <ul>
>> <li>level c</li>
>> </ul>
>> </li>
>> </ul>
>> </li>
>> </ul>
>>
>> This is a semantically and syntacticallycorrect UL. Keep in mind that
>> this can go many levels deeper. The hardest part, and the part that I am
>> looking to accomplish, is closing the list items properly regardless of how
>> deep the tree is. If properly handled this could even be made into JSON
>> with the proper syntax, but I am not worried about that now. I was hoping
>> that a fresh set of eyes would point me to a solution that I obviously
>> cannot see at the moment.
>>
>> Thanks!
>>
>> Jay
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux