title: PHP: Add missing dates in array
body: <p>I'm running the following query on my table: </p>
  
  <pre><code>SELECT DISTINCT(date(dateAdded)) AS dateAdded, count(*) AS count FROM clients WHERE (dateAdded BETWEEN '2012-06-15' AND '2012-06-30') GROUP BY dateAdded ORDER BY dateAdded ASC
  </code></pre>
  
  <p>That returns something like this: </p>
  
  <pre><code>2012-06-17 ¦ 5 
  2012-06-19 ¦ 2 
  2012-06-26 ¦ 3 
  2012-06-30 ¦ 2
  </code></pre>
  
  <p>I need to be able to fill in any missing dates in the date range like so:</p>
  
  <pre><code>2012-06-15 ¦ 0 
  2012-06-16 ¦ 0 
  2012-06-17 ¦ 5 &lt;--
  2012-06-18 ¦ 0 
  2012-06-19 ¦ 2 &lt;--
  2012-06-20 ¦ 0 
  2012-06-21 ¦ 0 
  2012-06-22 ¦ 0 
  2012-06-23 ¦ 0 
  2012-06-24 ¦ 0 
  2012-06-25 ¦ 0 
  2012-06-26 ¦ 3 &lt;--
  2012-06-27 ¦ 0
  2012-06-28 ¦ 0 
  2012-06-29 ¦ 0 
  2012-06-30 ¦ 2 &lt;--
  </code></pre>
  
  <p>I'd like to do this using a PHP loop of some sort, if possible. Any help would be greatly appreciated.</p>