title: Highcharts get data from database
body: <p>I'm trying to graph some data from my database on a <a href="http://www.highcharts.com/" rel="nofollow">Highchart</a>, but I can't seem to get the data to show.</p>
  
  <p>I have the following PHP (snippet) that gets the data from the database and json_encodes it:</p>
  
  <pre><code>&lt;?php
  
      $result = mysqli_query($cxn,"SELECT * FROM counter");
  
      while($row = mysqli_fetch_array($result)) {
          $value = $row['value'];
          $timestamp = strtotime($row['datetime']);
          $data[] = "[$value, $timestamp]";
      }   
  
      json_encode($data);
  
  ?&gt;
  </code></pre>
  
  <p>The json_encode prints the following (I'm using datetime):</p>
  
  <pre><code>["[500, 1384122794]","[600, 1384153203]"]
  </code></pre>
  
  <p>I then have the following to graph the data:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;div id="container" style="height: 500px; min-width: 500px"&gt;&lt;/div&gt;
  
          &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="http://code.highcharts.com/stock/highstock.js"&gt;&lt;/script&gt;
          &lt;script&gt;
              $(function() {
                  $.getJSON('http://www.website.com/graph.php', function(data) { // I put website.com on purpose
                      // Create the chart
                      $('#container').highcharts('StockChart', {
                          rangeSelector : {
                              selected : 1
                          },
  
                          title : {
                              text : 'Title'
                          },
  
                          series : [{
                              name : 'AAPL',
                              data : data,
                              tooltip: {
                                  valueDecimals: 2
                              }
                          }]
                      });
                  });
  
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The problem is that the graph doesn't actually show the points, it's just a blank graph.</p>
  
  <p>What am I doing wrong?</p>