title: Invalid JSON string
body: <p>Hi im trying to make a line chart for my web displaying data from my database in MysQL but i get an inavlidd JSON string error and nothing display this is my code.
  I'm using as example the server side code from <a href="https://developers.google.com/chart/interactive/docs/php_example" rel="nofollow">https://developers.google.com/chart/interactive/docs/php_example</a></p>
  
  <p>HTML</p>
  
  <pre><code>  &lt;html&gt;
    &lt;head&gt;
      &lt;!--Load the AJAX API--&gt;
      &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
      // Load the Visualization API and the piechart package.
      google.load('visualization', '1', {'packages':['corechart']});
  
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);
  
      function drawChart() {
       var jsonData = $.ajax({
        url: "getData.php",
        dataType:"json",
        async: false
        }).responseText;
  
  
  var data = new google.visualization.DataTable(); //DEFINE DATATABLE
  
  data.addColumn('string', 'Label'); //ADD COLUMN 1
  data.addColumn('number', 'Value'); //ADD COLUMN 2
  console.log(jsonData);
  data.addRows(jsonData); //ADD THE RECEIVED jsonData
  
  // SET OPTIONS
  var options = {'title':'REALLY PRETTY PIE CHART',
      'width':400,
      'height':300};
  
  // Instantiate and draw THE chart
  var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  chart.draw(data, options);
  }
      &lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;!--Div that will hold the pie chart--&gt;
      &lt;div id="chart_div"&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php 
  include_once  'Config.php'; //configuration of my Mysql Database  
  $public = 'admin'; //This variable is to select the user i want
  
  
  try {
  
          $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
      $gsent = $conn-&gt;prepare("SELECT estado,Hora FROM Datos Where Usuario LIKE '$public'");
          $gsent-&gt;execute();
  
  $resultado = $gsent-&gt;fetchAll();
  $resultAdoJson = json_encode($resultado);
  $resulset = json_decode($resultAdoJson);
  $result = array();
  $i = 65;
  foreach($resulset as $res) {
  
      $result[] = array(chr($i++), intval($res-&gt;estado));
  }
  
  
  
  print json_encode($result);
  }
  
   catch (PDOException $pe) {
  
      die("Could not connect to the database $dbname :" . $pe-&gt;getMessage());
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>The Mysql table only has 3 row for admin with values:</p>
  
  <p>Estado  Hora</p>
  
  <ul>
  <li>50         2015-02-16</li>
  <li>53         2015-02-16</li>
  <li>10         2015-02-16</li>
  </ul>
  
  <p>This is the JSON i get from the print in the php</p>
  
  <pre><code>[{"estado":"50","0":"50","Hora":"2015-02-16","1":"2015-02-16"},  {"estado":"53","0":"53","Hora":"2015-02-16","1":"2015-02-16"},{"estado":"10","0":"10","Hora":"2015-02-16","1":"2015-02-16"}]Array
  </code></pre>
  
  <p>var_dump($resultado)</p>
  
  <pre><code>array(3) { [0]=&gt; array(4) { ["estado"]=&gt; string(2) "50" [0]=&gt; string(2) "50" ["Hora"]=&gt; string(10) "2015-02-16" [1]=&gt; string(10) "2015-02-16" } [1]=&gt; array(4) { ["estado"]=&gt; string(2) "53" [0]=&gt; string(2) "53" ["Hora"]=&gt; string(10) "2015-02-16" [1]=&gt; string(10) "2015-02-16" } [2]=&gt; array(4) { ["estado"]=&gt; string(2) "10" [0]=&gt; string(2) "10" ["Hora"]=&gt; string(10) "2015-02-16" [1]=&gt; string(10) "2015-02-16" } } 
  </code></pre>
  
  <p>I know that the code display a pie chart, but because i'm a newbie with php and i dont know anything of json or javascript first i want to make the example like the one. How can i convert the result when it works into a line chart?</p>