title: fetching data from mysql databases
body: <p>Hello everyone is there any possibly to fetch data from mysql databases in javascript . For example i have the following code </p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;title&gt;Highcharts Example&lt;/title&gt;
  
  
          &lt;!-- 1. Add these JavaScript inclusions in the head of your page --&gt;
          &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="../js/highcharts.js"&gt;&lt;/script&gt;
  
          &lt;!-- 1a) Optional: add a theme file --&gt;
          &lt;!--
              &lt;script type="text/javascript" src="../js/themes/gray.js"&gt;&lt;/script&gt;
          --&gt;
  
          &lt;!-- 1b) Optional: the exporting module --&gt;
          &lt;script type="text/javascript" src="../js/modules/exporting.js"&gt;&lt;/script&gt;
  
  
          &lt;!-- 2. Add the JavaScript to initialize the chart on document ready --&gt;
          &lt;script type="text/javascript"&gt;
  
  
              Highcharts.setOptions({
                  global: {
                      useUTC: false
                  }
              });
  
              var chart;
              $(document).ready(function() {
                  chart = new Highcharts.Chart({
                      chart: {
                          renderTo: 'container',
                          defaultSeriesType: 'spline',
                          marginRight: 10,
                          events: {
                              load: function() {
  
                                  // set up the updating of the chart each second
                                  var series = this.series[0];
                                  setInterval(function() {
                                      var x = (new Date()).getTime(), // current time
                                          y = Math.random();
                                      series.addPoint([x, y], true, true);
                                  }, 500);
                              }
                          }
                      },
                      title: {
                          text: 'Live random data'
                      },
                      xAxis: {
                          type: 'datetime',
                          tickPixelInterval: 150
                      },
                      yAxis: {
                          title: {
                              text: 'Value'
                          },
                          plotLines: [{
                              value: 0,
                              width: 1,
                              color: '#808080'
                          }]
                      },
                      tooltip: {
                          formatter: function() {
                                  return '&lt;b&gt;'+ this.series.name +'&lt;/b&gt;&lt;br/&gt;'+
                                  Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'&lt;br/&gt;'+ 
                                  Highcharts.numberFormat(this.y, 2);
                          }
                      },
                      legend: {
                          enabled: false
                      },
                      exporting: {
                          enabled: false
                      },
                      series: [{
                          name: 'Random data',
                          data: (function() {
                              // generate an array of random data
                              var data = [],
                                  time = (new Date()).getTime(),
                                  i;
  
                              for (i = -19; i &lt;= 0; i++) {
                                  data.push({
                                      x: time + i * 1000,
                                      y: Math.random()
                                  });
                              }
                              return data;
                          })()
                      }]
                  });
  
  
              });
  
          &lt;/script&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
  </code></pre>
  
  <p>from this code </p>
  
  <pre><code>   data: (function() {
                              // generate an array of random data
                              var data = [],
                                  time = (new Date()).getTime(),
                                  i;
  
                              for (i = -19; i &lt;= 0; i++) {
                                  data.push({
                                      x: time + i * 1000,
                                      y: Math.random()
                                  });
                              }
                              return data;
  </code></pre>
  
  <p>instead of random no i want to fetch from the database . please guide </p>