Php 仪表图表未显示任何内容

Php 仪表图表未显示任何内容,php,html,mysql,Php,Html,Mysql,我试图在语言图表上显示mysql数据库的最新速度。我已经尝试了很多东西,但是gauge没有显示,plz可以帮助我…我的代码是附加的,php部分显示了正确的值,但不知道为什么gauge没有显示 <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="mysql"; // Database name $tbl_name

我试图在语言图表上显示mysql数据库的最新速度。我已经尝试了很多东西,但是gauge没有显示,plz可以帮助我…我的代码是附加的,php部分显示了正确的值,但不知道为什么gauge没有显示

<?php

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="mysql"; // Database name
$tbl_name="gpsdb"; // Table name

// Connect to server and select database.
$con=mysql_connect("$host", "$username")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$data = mysql_query("SELECT speed FROM gpsdb WHERE DeviceId=1234 ORDER BY TIME DESC LIMIT 1")
or die(mysql_error()); 

while ($nt = mysql_fetch_assoc($data))
{
$speed = $nt['speed'];
 $jsonTable = json_encode($speed);
 echo $jsonTable;

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
  Google Visualization API Sample
</title>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load('visualization', '1', {packages: ['gauge']});
</script>
<script type="text/javascript">
  function drawVisualization() {
    // Create and populate the data table.
    var data = new google.visualization.DataTable(<?=$speed?>);

    // Create and draw the visualization.
    new google.visualization.Gauge(document.getElementById('visualization')).
        draw(data);
  }

  google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="width: 600px; height: 300px;"></div>
</body>
</html>

尝试将变量$jsonTable传递给。DataTable感谢Deepak的回复…我已尝试传递$jsonTable,但它不工作我的浏览器仍显示空页控制台上有错误吗?没有错误,只有空白页