Php 连接到数据库时显示Google图表的问题

Php 连接到数据库时显示Google图表的问题,php,mysql,google-visualization,Php,Mysql,Google Visualization,我正试图让谷歌图表显示我的MySQL数据库中的图表。不幸的是,它没有显示任何内容。我知道一定有一些小错误,我错过了 <?php mysql_connect("Localhpst", "Username", "password"); mysql_select_db("DBName") or die(mysql_error()); $sth=mysql_query("SELECT * F

我正试图让谷歌图表显示我的MySQL数据库中的图表。不幸的是,它没有显示任何内容。我知道一定有一些小错误,我错过了

 <?php
        mysql_connect("Localhpst", "Username", "password");
         mysql_select_db("DBName") or die(mysql_error()); 


                 $sth=mysql_query("SELECT *
                FROM Graph")
             or die(mysql_error());

         $rows = array();
         $flag = true;
         $table = array();
         $table['cols'] = array(


             array('label' => 'people', 'type' => 'string'),
             array('label' => 'total', 'type' => 'number')
           );

        $rows = array();
            while($r = mysql_fetch_assoc($sth)) {
               $temp = array();
               $temp[] = array('v' => (string) $r['people']); 
               $temp[] = array('v' => (int) $r['total']);
               $rows[] = array('c' => $temp);
           }

      $table['rows'] = $rows;
      $jsonTable = json_encode($table);
  //echo $jsonTable;
 ?>

<html>
  <head>

   <script type="text/javascript" src="https://www.google.com/jsapi"></script>
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
   <script type="text/javascript">

       // 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() {

        // Create our data table out of JSON data loaded from server.
         var data = new google.visualization.DataTable(<?=$jsonTable?>);
         var options = {
            title: ' Something ',
            is3D: 'true',
            width: 800,
            height: 600
        };

     var chart = new   google.visualization.PieChart(document.getElementById('chart_div'));
  chart.draw(data, options);
  }
 </script>
</head>

  <body>
     <!--this is the div that will hold the pie chart-->
       <div id="chart_div"></div>
       </body>
   </html>

//加载可视化API和piechart包。
load('visualization','1',{'packages':['corechart']});
//将回调设置为在加载Google Visualization API时运行。
setOnLoadCallback(drawChart);
函数绘图图(){
//使用从服务器加载的JSON数据创建我们的数据表。
var data=new google.visualization.DataTable();
变量选项={
标题:“某物”,
is3D:'正确',
宽度:800,
身高:600
};
var chart=new google.visualization.PieChart(document.getElementById('chart_div');
图表绘制(数据、选项);
}

缺少的内容将导致此屏幕上不显示任何内容。它显示的唯一内容是标题中的“某物”。我知道数据库中有数据,所以这不是问题所在。我也相当肯定这不是一个连接问题,所以我被难住了

您的浏览器控制台上有JavaScript错误吗?