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

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

 



[snip]
Doesn't this SQL query return everything that has company_id set to 3 which would it not contain all the data from the other queries combined into one large data set?
[/snip]

I could do that, I can return one large dataset for all of the columns shown in the tiers array. I have to remove the DISTINCT's. When I return that dataset in this case I return seven columns of data with the parent being in the leftmost column and descending to the right. The goal with the the recursive function was to get each descendant line so that it could be formatted in a nested unordered list. So in the SQL below you get 9 records. For each of the 9 records you could get any number of children depending on which of the 9 you're looking at. Then for each of those children you could get their descendants and so on.

I was doing it the long way at first, until a recursive function was suggested. The problem that I was having there was formatting the <ul>'s and <li>'s properly.

Now I feel as if I am really close to a better solution than the brute force method. I may just be a little too frustrated to see what is a simple answer.

Thanks for your help!




At this point, I don't believe you have shown your output. Please show the output of your function.

0
SELECT DISTINCT `TIER1DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3'
Executives and Management

Normally this query alone returns 9 rows of data. Each of these rows should be included in the next query where TIER1DATA = each of the nine in succession

1
SELECT DISTINCT `TIER2DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' AND `TIER1DATA` = 'Executives and Management'
  Executives and ManagementLeadership


--
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