I have this query (it is working):
 $filesQuery = "SELECT COUNT( cs_file.iduser ) AS newFile, DATE( cs_file.add_date ) AS
            dateAdded
            FROM cs_file
            INNER JOIN cs_team_has_user ON cs_team_has_user.iduser = cs_file.iduser
            INNER JOIN cs_portal_has_team ON cs_portal_has_team.idteam = cs_team_has_user.idteam
            WHERE cs_file.add_date  >= DATE(NOW()) - INTERVAL {$range} DAY
            AND cs_file.isImage = 0
            GROUP BY DATE( cs_file.add_date )
            WITH rollup";
The query gives me this result:
[0]=>
  array(2) {
    ["newFile"]=>
    string(2) "12"
    ["dateAdded"]=>
    string(10) "2016-03-23"
  }
  [1]=>
  array(2) {
    ["newFile"]=>
    string(1) "2"
    ["dateAdded"]=>
    string(10) "2016-04-01"
  }
  [2]=>
  array(2) {
    ["newFile"]=>
    string(2) "10"
    ["dateAdded"]=>
    string(10) "2016-04-22"
  }....
What I need to make is make dateAdded a key and newFile (the count) a value. Like this:
[
'2016-03-23' => '12',
'2016-04-01' => '2',
'2016-04-22' => '10'
]
Is this possible with the query? Or there is some more efficient way, then using foreach loop?