i'm working on a small project using PHP and Mysql and i want to create a sales chart of 2018 and 2019 to show the difference of sales, month by month
right now i have only some months records of 2018 and 2019. How can i add all the months with 0 as a value if i don't have a sales in some months. the essential for me is to show 12 months of year.
this is my database result, as you can see i have only month number 6 wich is(June). how can i add all the months with 0 as a value if i have no record.
Array
(
[0] => Array
(
[year] => 2018
[month] => 6
[total] => 1200.000000
)
[1] => Array
(
[year] => 2019
[month] => 6
[total] => 6000.000000
)
)