title: Google Chart error: "X values column cannot be of type string"
body: <p>I am trying to use a google line chart. I can get the <code>x</code> and <code>y</code> values printed on the page using <code>echo</code>, but not in the chart. It gives me the following error:</p>
  
  <blockquote>
    <p>"X values column cannot be of type string"</p>
  </blockquote>
  
  <p>I also closed the while loop after the DataTable but it did not work either.</p>
  
  <p>The code is as follows:</p>
  
  <pre><code>&lt;?php
  
  @mysql_connect("localhost","root","") or die ("MYSQL'e Baglanti Yok"); 
  @mysql_select_db("exceltosql") or die ("Veritabanina baglanti yapilamadi"); 
  $sql1= "SELECT x,y FROM veri  ";
  $result1=mysql_query($sql1) or die(mysql_error());
  $result_array = array();
  while($row1 = mysql_fetch_array($result1)){
  $result_array[] = $row1;
  
  echo "&lt;pre&gt;";
  echo $row1 ['x'];
  echo $row1 ['y'];
  }
  ?&gt;
  &lt;html&gt;
    &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
      &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
  
        google.load("visualization", "1", {packages:["corechart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
          var data = google.visualization.arrayToDataTable([
          ['x', 'y'], 
          ['&lt;?php $row1 ['x'];?&gt;', '&lt;?php $row1 ['y'];?&gt;'],
  
  
  
          ]);
  
          var options = {
            title: 'VO2 vs. VCO2 grafiği',
            hAxis: {title: 'VCO2', minValue: 600, maxValue: 1500},
            vAxis: {title: 'VO2', minValue: 600, maxValue: 1500},
            legend: 'none'
          };
  
          var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
  
          chart.draw(data, options);
        }
  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="chart_div" style="width: 900px; height: 500px;"&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>