Filling gaps in dates
Posted on
16th Feb 2014 07:03 pm by
admin
So i'm doing a query for sales data and my return array looks like this
('date' => '2008-11-01 00:00:00', 'total' => 1),
('date' => '2008-11-03 00:00:00', 'total' => 3),
('date' => '2008-11-04 00:00:00', 'total' => 3),
('date' => '2008-11-07 00:00:00', 'total' => 5),
('date' => '2008-11-12 00:00:00', 'total' => 1)
There are obviously gaps in my dates. What i'm trying to figure out is the best approach to filling those empty dates with a total of 0 so my graphs don't look all jacked up because i'm not providing all the data. Does anyone have an idea how to approach this problem to fill in the missing dates? I'd like the array to look like the following:
('date' => '2008-11-01 00:00:00', 'total' => 1),
('date' => '2008-11-02 00:00:00', 'total' => 0),
('date' => '2008-11-03 00:00:00', 'total' => 3),
('date' => '2008-11-04 00:00:00', 'total' => 3),
('date' => '2008-11-05 00:00:00', 'total' => 0),
('date' => '2008-11-06 00:00:00', 'total' => 0),
('date' => '2008-11-07 00:00:00', 'total' => 5),
('date' => '2008-11-08 00:00:00', 'total' => 0),
('date' => '2008-11-09 00:00:00', 'total' => 0),
('date' => '2008-11-10 00:00:00', 'total' => 0),
('date' => '2008-11-11 00:00:00', 'total' => 0),
('date' => '2008-11-12 00:00:00', 'total' => 1)
No comments posted yet
Your Answer:
Login to answer
234
46
Other forums
Multi Level Array Problem
hi all,
For example I have array like below:
$temp = array(array('north america', 'us'
dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button tha
Scrolling news bar and MySQL
I am not sure if this is the correct forum to post this on. If not, I apologize. I am still pretty
Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:
QuoteBlah blah
Blah blah
etc
but when i ech
How do i use vars in an array
Hiya peeps!
How do I use a var in an array. You will see $id but it isnt working.
pass form variables straight to email, no database required?
hello all,
im working on this form...
http://www.adobedayevents.com/project_request/pr
newbie error
what is wrong with this code ?
<html>
<body>
<?
Rss feed question
Hi
My blog and my website are different. Am i able to take my rss feed
from my blog and p
Saas with SAP R/3
hi experts,
Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a
Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le