执行php代码时,我一直遇到以下错误
解析错误:语法错误,第37行/home/a9440109/public_html/gps_list.php中的意外T_CONSTANT_ENCAPSED_STRING
我试图定义字符编码但仍然收到错误。请让我知道我做错了什么:
<?php
header('Content-type: text/html; charset=utf-8');
//connect to the database
include ('gps_db_connect.php');
$query = "SELECT * from gps WHERE server_time > '20130130'";
$result = mysqli_query($connection, $query) or die(' Error getting data');
echo $query;
$row_count = 0;
$color_switch = 0;
$td_size=1;
$td_font='Verdana'';
echo "<table border = 1 WIDTH=100% CELLSPACING=0 CELLPADDING=1 >";
echo "<tr> <th>Count</th><th>User/Device ID</th><th>Longitude, Latitude</th> <th></th> <th> Speed</th> <th> Direction </th> <th> GPS Date/Time</th> <th> Server Time </th></tr>";
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
if ( $color_switch == 0 ) {
$bg_color="#FFFFFF";
$color_switch = 1;
}
else {
$bg_color="#D8D8D8";
$color_switch = 0;
}
$row_count++;
echo "<tr><td bgcolor=$bg_color> <font size=$td_size face=$td_font>";
echo $row_count;
echo "</td><td bgcolor=$bg_color> <font size=$td_size face=$td_font>  ";
echo $row['gps_user'];
echo "</td><td bgcolor=$bg_color> <font size=$td_size face=$td_font>  ";
echo $row['gps_lng'].','.$row['gps_lat'];
echo "</td></tr>";
}
echo "</table>";
?>
答案 0 :(得分:0)
将$td_font='Verdana'';
替换为$td_font='Verdana';
答案 1 :(得分:0)
$td_font='Verdana'';
最后有一个额外的引用。