title: Highcharts Data (using PHP JSON MYSQL)
body: <p>When I used "data.php" data from the file itself doesn't read. But when I use "data.json" data from that file are showed in highcharts</p>
  
  <pre><code> $(function () {
      var chart;
      $(document).ready(function() {
          $.getJSON("***data.php***", function(json) {
  
              chart = new Highcharts.Chart({
                  chart: {
                      renderTo: 'container',
                      type: 'column',
                      marginRight: 130,
                      marginBottom: 25
                  },
                  title: {
                      text: 'Revenue vs. Overhead',
                      x: -20 //center
                  },
                  subtitle: {
                      text: '',
                      x: -20
                  },
                  xAxis: {
                      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
                  },
                  yAxis: {
                      title: {
                          text: 'No. of Events'
                      },
                      plotLines: [{
                          value: 0,
                          width: 1,
                          color: '#808080'
                      }]
                  },
                  tooltip: {
                      formatter: function() {
                              return '&lt;b&gt;'+ this.series.name +'&lt;/b&gt;&lt;br/&gt;'+
                              this.x +': '+ this.y;
                      }
                  },
                  legend: {
                      layout: 'vertical',
                      align: 'right',
                      verticalAlign: 'top',
                      x: -10,
                      y: 100,
                      borderWidth: 0
                  },
  
                   plotOptions: {
              column: {
                  stacking: 'normal',
                  dataLabels: {
                      enabled: true,
                      color: (Highcharts.theme &amp;&amp; Highcharts.theme.dataLabelsColor) || 'white',
                      style: {
                          textShadow: '0 0 3px black'
                      }
                  }
              }
          },
                  series: json
              });
          });
  
      });
  </code></pre>
  
  <p><strong>data.json</strong>.....................................</p>
  
  <pre><code>    [{
      "name": "Revenue",
      "data": [23987, 24784, 25899, 25569, 25897, 25668, 24114, 23899, 24987, 25111, 25899, 23221]
  }, {
      "name": "Overhead",
      "data": [21990, 22365, 21987, 22369, 22558, 22987, 23521, 23003, 22756, 23112, 22987, 22897]
  }];
  </code></pre>
  
  <p><strong>data.php</strong>......................</p>
  
  <pre><code>    &lt;?php
  $con = mysql_connect("localhost","root","");
  
  if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db("highcharts", $con);
  
  $sth = mysql_query("SELECT revenue FROM projections_sample");
  $rows = array();
  $rows['name'] = 'Revenue';
  while($r = mysql_fetch_array($sth)) {
      $rows['data'][] = $r['revenue'];
  }
  
  $sth = mysql_query("SELECT overhead FROM projections_sample");
  $rows1 = array();
  $rows1['name'] = 'Overhead';
  while($rr = mysql_fetch_assoc($sth)) {
      $rows1['data'][] = $rr['overhead'];
  }
  
  $result = array();
  array_push($result,$rows);
  array_push($result,$rows1);
  
  
  print json_encode($result, JSON_NUMERIC_CHECK);
  
  mysql_close($con);
  ?&gt;
  </code></pre>