我试图显示每个项目组的总数。问题是该字段的所有值都记录如下:
0h 06m
总和显示为:
0
使用以下代码。如何以正确的 HH:MM 格式显示总结果
<?
$query = "SELECT taskname, SUM(tasktime) FROM tictoc WHERE uid = '6' 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 />";
}
?>