Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I m really stuck with this from 1 week, can anyone please help me in creating an array for creating an grouped categories in Highcharts from a database dynamically using php.Here is an example of a table

<pre><code>
   +-------+---------------+---------------------------+
   |BATCH  |   CATEGORY    |         GENDER            |
   +-------+---------------+---------------------------+
   | 2012  |    General    |   Male                    |
   | 2012  |    Test       |   Female                  |
   | 2013  |    General    |   Female                  |
   | 2013  |    Test       |   Male                    |
   +-------+---------------+---------------------------+
   </code></pre>

and i want this table to be structured like this

 <pre><code>
   Array ( [0] => 
            Array ( [name] => 2012 
                    [categories] => 
                    Array ( [0] => Array ( [name] => General 
                                           [categories] => Array ([0] => Male )) 
                            [1] => Array ( [name] => Test 
                                           [categories] => Array ([0] => Female )))) 
        [1] => 
            Array ( [name] => 2013 
                    [categories] => 
                    Array ( [0] => Array ( [name] => General 
                                           [categories] => Array ([0] => Female )) 
                            [1] => Array ( [name] => Test 
                                           [categories] => Array ([0] => Male )))) 
        )
   </code></pre>

please help me.......

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.