title: Generating json data for StockChart from PHP
body: <p>I can not get my generator working for the StockChart, is it because of the generator syntax output?</p>
  
  <p>Javascript </p>
  
  <pre><code>$(function () {
          // Create the chart
          $('#graphr').highcharts('StockChart', {
  
  
              rangeSelector : {
                  selected : 1
              },
  
              title : {
                  text : 'AAPL Stock Price'
              },
  
              series : [{
                  name : 'AAPL Stock Price',
                  data : 'http://127.0.0.1:1234/zwrotkav2/api/stockchart.php',
                  marker : {
                      enabled : true,
                      radius : 3
                  },
                  shadow : true,
                  tooltip : {
                      valueDecimals : 2
                  }
              }]
          });
  
  });
  </code></pre>
  
  <p>SQL Result.</p>
  
  <pre><code>Date | totalCOunt
  0000-00-00 | 14
  2013-10-13 |  3
  2013-10-16 |  1
  2013-10-17 |  1
  2013-10-18 |  2
  2013-10-25 |  4
  </code></pre>
  
  <p>My Php generator</p>
  
  <pre><code>require_once("../db_config.php");
  
    try { 
      $sth = $db-&gt;prepare("SELECT  DATE(date) Date, COUNT(DISTINCT number) totalCOunt FROM numbers GROUP   BY  DATE(date)");
      $sth-&gt;execute();
  
      /* Fetch all of the remaining rows in the result set */
      // print("Fetch all of the remaining rows in the result set:\n");
      $result = $sth-&gt;fetchAll();
  
       } 
      catch(PDOException $ex){ die("Failed to run query: " . $ex-&gt;getMessage());} 
  
  try{
          foreach ($result as $row) {
          $date =strtotime($row['Date'])*1000;
          echo "[".$date.",". $row['totalCOunt']."],&lt;br&gt;"; 
          }
  }
  catch(PDOException $ex){ die("Failed to run query: " . $ex-&gt;getMessage());} 
  </code></pre>
  
  <p>Generator output
  (example acceptable json <a href="http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&amp;callback=" rel="nofollow">http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&amp;callback=</a>? )</p>
  
  <pre><code>[1384038000000,2],
  [1384124400000,1],
  [1384210800000,1],
  [1384556400000,1],
  [1384729200000,4],
  [1385247600000,2],
  [1385334000000,2],
  [1385420400000,2],
  [1385506800000,3],
  [1385593200000,1],
  </code></pre>
  
  <hr>
  
  <p>Edit 2.</p>
  
  <p>Using Json_Encode - generator output</p>
  
  <pre><code>[[0,"14"],[1381788000000,"3"],[1381874400000,"1"],[1381960800000,"1"],[1382047200000,"2"],[1382652000000,"4"],[1383001200000,"1"],[1383174000000,"1"],[1383433200000,"1"],[1383606000000,"1"],[1384038000000,"2"],[1384124400000,"1"],[1384210800000,"1"],
  </code></pre>
  
  <p>php loop</p>
  
  <pre><code>foreach ($result as $row) {
              $date =strtotime($row['Date'])*1000;
              $return[] = array($date,$row['totalCOunt']); 
  }
  </code></pre>