I have the following code:
$query6 = "SELECT TIMESTAMP As sDate, COUNT( TIMESTAMP ) AS Total
FROM tresults GROUP BY TO_DAYS( timestamp ) ";
$result6 = $mysqli->query($query6);
$rows = array();
while($row6 = $result6->fetch_array())
{
$rows[]=$row6;
}
Whilst this works, the output is as follows but isn't what I expected:
Array ( [0] => Array ( [0] => 2014-05-14 02:11:16 [1] => 1 )
[1] => Array ( [0] => 2014-05-19 05:05:17 [1] => 76 )
[2] => Array ( [0] => 2014-05-20 00:28:41 [1] => 35 )
[3] => Array ( [0] => 2014-05-21 01:24:01 [1] => 25 ) )
I had expected the result to be in a single array not multi-arrays.
Clearly the output is correct based on my code but what I am struggling with is then (within PHP) looping through the above array and echo'ing the output.
If anyone can advise on the code need to either loop through the above correctly or advise on changing the above so the output is within one array (which I know how to loop through) - that would be appreciated.