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);
while($row6 = $result6->fetch_row())
{
$dt = new DateTime($row6[0]);
$sd = $dt->format('M j');
echo "['".$sd."', ".$row6[1]."],";
}
This works fine, but what I am struggling with is that I need the echo
to be different the for the last one in the loop. It needs to be (the comma is missing after the ]
for reference):
echo "['".$sd."', ".$row6[1]."]";
I've been trying to do a count of the number of arrays but cannot get that to work. Any suggestions welcomed.