I am creating a line graph in flot, I have it all working except for the days which do not have a result I need them to come back with a result 0 + date. Is this possible in mysql? Here is my current query:
$chartQuery = "SELECT count(date) as counted_leads, UNIX_TIMESTAMP(date) as time FROM enquiries WHERE visibility != 'deleted' group by date";
Or would I need to do it in my php? Here is my code:
<?php
$last_key = end(array_keys($chartResults));
foreach ($chartResults as $item => $value)
{
$timestamp = round($value['time'] * 1000);
if ($item == $last_key)
{
// last element
echo '['.$timestamp.', '.htmlentities($value['counted_leads']).']';
}
else
{
// not last element
echo '['.$timestamp.', '.htmlentities($value['counted_leads']).'],';
}
}
unset($value);
?>
I think this is what you are looking for: