I have a sql table which looks like this :-
date sales
2017-04-01 230
2017-04-02 120
2017-04-03 81
2017-04-04 911
2017-04-05 90
2017-04-06 11
2017-04-09 9
2017-04-10 140
2017-04-11 90
As it can be seen that for 2017-04-07 and 2017-04-08 there is no data. Following is query and php array :-
$sql="select sales from sales_data where date >= '2017-04-03'";
$RS=mysql_query($sql);
while(($row = mysql_fetch_assoc($RS))) {
$sales_val[] = $row['sales'];
}
The code works fine, however I want to store a zero in case the date is not present in the sql table. Is it possible to insert zero in the php array in this case where the date is not present ?