Show missing dates inside loop even if they don't exist inside MYSQL -


i have following mysql query

select count(order_id), date tbl_order campaign_status = 'in progress' or campaign_status = 'pending' group date_format(date,'%d %b %y')

and following loop

<?php { ?>    ['<?php echo $row_chartdata['date']; ?>', <?php echo $row_chartdata['count(order_id)']; ?>], <?php } while ($row_chartdata = mysql_fetch_assoc($chartdata)) ?> 

this loop used create data chart. problem there days users dont make orders in store dates not stored inside database, when loop trough dates not showed in above results , inside chart.

the question have, there way show missing dates in loop above if dont exist inside mysql database.

thanks help.

well, in case, create temporary array based on date range, e.g. if want show graph may 1, may 31. loop 1 30,

set $data[i] = 0; 

now loop through db records , set

$data['date'] = $row['count'] 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -