【发布时间】:2013-11-22 19:47:19
【问题描述】:
我在 MYSQL 中遇到错误
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
有人可以向我解释一下这个错误是怎么回事吗?谢谢。
PHP 代码:
<?php
$link = connectToDB();
$strXML = "<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>";
$result = mysqli_query($link, "SELECT DISTINCT PROFILE FROM tbljocreator GROUP BY PROFILE");
$show = mysqli_fetch_array($result);
if($result) {
while ($ors = mysqli_fetch_array($result)) {
$strQuery = "select PROFILE, sum(MT) as totalLM from tbljocreator where PROFILE =" .$ors['PROFILE'];
$result2 = mysqli_query($link, $strQuery) or die(mysqli_error($link));
$getresult2 = mysqli_fetch_array($result2);
$strXML .= "<set label='" . $ors['profile'] . "' value ='" . $getresult2['totalLM'] . "' />";
mysqli_free_result($result2);
}
}
mysqli_close($link);
$strXML .= "</chart>";
echo renderChart("FusionCharts/Column3D.swf", "", $strXML, "JoCreator", 450, 300, false, true);
?>
请给我解释清楚。
【问题讨论】:
-
PROFILE 字段是 int 字段吗?如果不是,则需要添加单引号来表示字符串
-
你能帮我解释一下吗?
标签: php