[snip]
...stuff...
[/snip]

Here is the explanation for what I have done and what I am trying to do - (based on the customer's request).

A week or so ago I took a set of queries from one table and made them into an unordered list. This will be pseudo-code so that you get idea.

SELECT DISTINCT column1 FROM table
WHERE company = '1'

while($column1 = mysql_fetch_array($query1results)){
    SELECT DISTINCT column2 FROM table
    WHERE company = '1'
    AND column1 = $column1[0]

    while($column2 = mysql_fetch_array($query2results)){
        SELECT DISTINCT column3 FROM table
        WHERE company = '1'
        AND column2 = $column2[0]
    }
}

This continues for up to 14 columns of data. I'm not worried about the recursive data retrieval, I have that part and like I said - I can output a nested unordered list from it quite handily.

Now the customer wants JSON as the output. The JSON must reflect the children properly.

So I have two choices, a multidimensional array that I can use json_encode() on or output a string that ultimately forms the JSON. We have all agreed that doing an array would be the best thing but I cannot wrap my head around it.

If you have more questions fire away - I'd love to get this solved and off of my plate.

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

Reply via email to