我有下面的代码,我希望总数是 12:37:47,但我得到的是 12 的整数。这些是结果:
类别 1 - 06:02:06
类别 2 - 06:35:41
总计 - 12
我怎样才能得到 12:37:47 的总结果?
$sql = "SELECT hesk_categories.name, COALESCE(NULLIF(SEC_TO_TIME(SUM(TIME_TO_SEC(TimeSpent))),0),'00:00:00') AS TimeSpent from hesk_categories left Join hesk_tickets on hesk_categories.id = hesk_tickets.category left join TimeSpent on hesk_tickets.id = TimeSpent.ID and (DateCreated between DATE_FORMAT(NOW() ,'%Y-%m-01') AND NOW() ) where hesk_categories.name <> 'Feature Request' group by hesk_categories.name";
$query = mysqli_query($con, $sql);
while ($row = mysqli_fetch_array($query))
{
$TimeSpent = $row['TimeSpent'];
$TimeSpent = $TimeSpent + $TimeSpent;
$message.="<tr>";
$message.="<td>" . $row['name'] . "</td>";
$message.="<td>" . $row['TimeSpent'] . "</td>";
$message.="<tr>";
}
$message.="<tr>";
$message.="<td>Total</td>";
if ($TimeSpent >= '10:00:00')
{
$message.="<td><b><font color='red'>" . $TimeSpent . " (Support Hours have exceeded 10 hours for the month.)</font></b></td>";
}
else
{
$message.="<td>" . $TimeSpent . "</td>";
}
$message.="</tr>";
$message.="</table><br>";
慕仙森