php create and populate multidimensional array for DataTables
<p>I am working with DataTables and it requires a specific format for the JSON object in order to populate the tables.</p>

<p>It should look like this:</p>

<pre><code>{"aaData": [
        [ "Trident", "Internet Explorer 5.1", "Win 95+", 4, "X" ],
        [ "Trident", "Internet Explorer 5.0", "Win 95+", 5, "C" ],
        [ "Trident", "Internet Explorer 5.5", "Win 95+", 5.5, "A" ],
        [ "Trident", "Internet Explorer 6.0", "Win 98+", 6, "A" ],
        [ "Trident", "Internet Explorer 7.0", "Win XP SP2+", 7, "A" ]
}
</code></pre>

<p>I have tried hundred's of different ways, but cannot get to something that looks like the above and so DataTables does not accept it.</p>

<p>This is one of my latest attempts:</p>

<pre><code>$aaData["aaData"] = array(array());
$i=0;
while($r= mysql_fetch_assoc($sql)){
    $aaData[$i][] = $r["data1"];
            $aaData[$i][] = $r["data2"] ;
            $aaData[$i][] = $r["data3"] ;
    $aaData[$i][] = $r["data4"] ;
            $aaData[$i][] = $r["data5"] ;

            $i++;
}
$aaData=json_encode($aaData);
echo $aaData;
</code></pre>

<p>This give me an JSON response from the server ( as verified by Firebug) that looks like this:</p>

<pre><code>{"aaData":[
[]],
"0":["data1","data2","data3","data4","data5"],
"1":["data11","data21","data31","data41","data51"],
etc.....]
}
</code></pre>

<p>So, I do not need the keys ( 0,1...) nor do I need the "[]]" stuff. 
I did look at similar post here and everywhere, but did not find anything that helps me with this.
How can I get rid of them?
Thanks for your assistance.</p>
