title: JSON MySQL for each date between start and end add to JSON encode
body: <p>I have a table in MySQL which has a <code>startdate</code> and <code>enddate</code>.</p>
  
  <p>An example of 1 row would be(disregard the naming throughout):</p>
  
  <pre><code>eg 
  startdate -&gt; 20121224
  endate -&gt; 20121226
  title -&gt; name
  etc
  </code></pre>
  
  <p>The current script I have works great and adds to JSON for each row, BUT.....
  I want to.... for each mysql row get the startdate and enddate, for each date inclusive within the startdate and enddate add to JSON encode.</p>
  
  <p><strong>Therefor rather than the above example of 1 row returning:</strong></p>
  
  <pre><code>[{
      "user": "378",
      "date": "UNIX_TIMESTAMP(startdate)",
      "title": "name",
      "description": "6 Days",
      "url": "UNIX_TIMESTAMP(enddate)",
      "bmanager": "manager name",
      "academic_year": "20120801",
      "division": "division name",
      "manager_id": "3"
  }]
  </code></pre>
  
  <hr>
  
  <p><strong>It would return 3 JSON for the one row for each of the dates:</strong></p>
  
  <pre><code>[{
      "user": "378",
      "date": "UNIX_TIMESTAMP(1st date)",
      "title": "name",
      "description": "6 Days",
      "url": "UNIX_TIMESTAMP(1st date)",
      "bmanager": "manager name",
      "academic_year": "20120801",
      "division": "division name",
      "manager_id": "3"
  }, {
      "user": "378",
      "date": "UNIX_TIMESTAMP(2nd date)",
      "title": "name",
      "description": "6 Days",
      "url": "UNIX_TIMESTAMP(2nd date)",
      "bmanager": "manager name",
      "academic_year": "20120801",
      "division": "division name",
      "manager_id": "3"
  }, {
      "user": "378",
      "date": "UNIX_TIMESTAMP(3rd date)",
      "title": "name",
      "description": "6 Days",
      "url": "UNIX_TIMESTAMP(3rd date)",
      "bmanager": "manager name",
      "academic_year": "20120801",
      "division": "division name",
      "manager_id": "3"
  }, ]
  </code></pre>
  
  <hr>
  
  <p><strong>JSON</strong></p>
  
  <pre><code>&lt;?php
      header('Content-type: text/json');
  
      $lmanager = $_GET["lmanager"];
  
      $sqldata = mysql_query('
      SELECT
      requests.user,
      UNIX_TIMESTAMP(requests.start_date) AS date,
      requests.employee AS title, 
      requests.days AS description,
      UNIX_TIMESTAMP(requests.end_date) AS url,
      business.line_manager AS bmanager,
      requests.academic_year,
      business.academic_year,
      business.division,
      line_managers.userid AS manager_id
      FROM requests 
      INNER JOIN holiday_entitlement_business_manual AS business ON requests.user=business.userid AND requests.academic_year=business.academic_year
      INNER JOIN line_managers ON business.line_manager=line_managers.name
      WHERE requests.approved = 1 AND line_managers.userid = '.$lmanager.'
      ');
  
      $posts = array();
  
      while($row = mysql_fetch_assoc($sqldata))
      {
          $row['date'] = $row['date'].'000';
          $row['url'] = $row['url'].'000';
          $row['description'] = $row['description'].' Days';
          $posts[] = $row;
      }
  
      mysql_free_result($sqldata);
      die(json_encode($posts));
  ?&gt;
  </code></pre>