我的 sysntax 是怎么回事,我做错了。有没有更好的办法?
<?
$uid = $_GET["uid"];
$month= $_GET["month"];
$year = $_GET["year"];
$query = "SELECT taskname,uid,month,year, SUM(tasktime) FROM tictoc WHERE uid = $uid, month = $month, year = $year GROUP BY taskname";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo "<br />";
echo "Total ". $row['taskname']. " = <strong>". $row['SUM(tasktime)']."</strong>";
echo "<br />";
}
?>
错误是:
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 ' month = 'Aug', year = '2012' GROUP BY taskname' at line 1