Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jay Blanchard
My usual approach to a problem like this to to includes a parent column in the table ID (int pk) Parent ( default null ) // no parent Item Itemtype [etc] Parent will then hold either a null if a top level item, or a structured path ( 1/10/24 ) that notes the parents of the item all

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jim Lucas
On 03/01/2012 06:20 PM, Jay Blanchard wrote: [snip] Can you show the output of the function above? [/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? At this point,

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Bastien Koert
On Fri, Mar 2, 2012 at 7:43 AM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: My usual approach to a problem like this to to includes a parent column in the table ID (int pk) Parent ( default null ) // no parent Item Itemtype [etc] Parent will then hold either a null if a top

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jay Blanchard
[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

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jay Blanchard
[snip] ...stuff ... [/snip] A thought occurred to me - I need to call the function at the end of the while loop and then again with different criteria after the while loop? I'll have to test that later today. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jim Lucas
On 03/02/2012 08:27 AM, Jay Blanchard wrote: [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

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-02 Thread Jay Blanchard
[snip] I'm not saying you should get rid of the recursive function calls, but rather, why not pull all your data in one SQL call, then use recursive functions on the returned array of data. It will save a little time by not hitting the DB on each function call too. [/snip] I'll just need

[PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
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

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread FeIn
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

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread FeIn
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 aci...@gmail.com wrote: I don't how how you keep your data in your database but there is no need to issues that

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Tommy Pham
On Thu, Mar 1, 2012 at 6:29 AM, Jay Blanchard jay.blanch...@sigmaphinothing.org 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

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
Thanks FeIn, I'll give these articles and methods a look this afternoon. I'm sure that it will lead to more questions, so I'll be back. On 3/1/2012 9:16 AM, FeIn wrote: And see also this, which focuses only on the database part of the problem:

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
On 3/1/2012 9:59 AM, Jay Blanchard wrote: Thanks FeIn, I'll give these articles and methods a look this afternoon. I'm sure that it will lead to more questions, so I'll be back. I also forgot to say that I cannot modify the database structure - the client is very strict about that. But it

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
[snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers…. Array ( [0] = TIER1DATA [1] = TIER2DATA [2] = TIER3DATA [3] = BUSTIER1DATA [4] = BUSTIER2DATA [5] = BUSTIER3DATA [6] =

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
On Mar 1, 2012, at 6:36 PM, Jay Blanchard wrote: [snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers…. Array ( [0] = TIER1DATA [1] = TIER2DATA [2] = TIER3DATA [3] = BUSTIER1DATA

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jim Lucas
On 03/01/2012 04:39 PM, Jay Blanchard wrote: On Mar 1, 2012, at 6:36 PM, Jay Blanchard wrote: [snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers…. Array ( [0] = TIER1DATA [1] = TIER2DATA

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Tommy Pham
On Thu, Mar 1, 2012 at 4:36 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: [snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers…. Array (    [0] = TIER1DATA    [1] = TIER2DATA    [2] =

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
On Mar 1, 2012, at 7:45 PM, Jim Lucas wrote: On 03/01/2012 04:39 PM, Jay Blanchard wrote: On Mar 1, 2012, at 6:36 PM, Jay Blanchard wrote: [snip]…stuff…[/snip] I am getting close, but I am also getting frustrated. I probably need to walk away for a bit. I have an array of tiers….

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Jay Blanchard
[snip] Can you show the output of the function above? [/snip] 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 =

Re: [PHP] Nested database loops and completing an unordered list....

2012-03-01 Thread Bastien
On 2012-03-01, at 9:20 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: [snip] Can you show the output of the function above? [/snip] 0 SELECT DISTINCT `TIER1DATA` FROM `POSITION_SETUP` WHERE `COMPANY_ID` = '3' Executives and Management Normally this query alone returns 9