Hi,
I'm building a time report system for work and I want to show the total hours and minutes a project have taken but can't get it to work ...
I have a database (MySQL) in one table I have the date in one colum and the time in one colum. The date i formated like this YYYY-MM-DD and set to date. And the TIME is like this HH:mm:ss.
My code looks like this right now...
[PHP]<?php
$sql="select
p.id, p.date, p.time
from rap_time p
order by 1 desc";
$rows = mysql_query($sql);
$totaltime = 0;
while($row = mysql_fetch_array($rows)) {
echo"$row[1]";
echo", ";
echo"$row[2]";
echo"<br />";
$totaltime = $totaltime + $row[2];
}
echo"$totaltime";
?>
[/PHP]
The $totaltime just shows the total hours and it does not count the hours and minutes together.
So if I have an output of times that looks like this:
01:10:00
01:13:00
01:40:00
the totaltime will show:
3
Not 04:03:00
And yes I'm a noob on PHP and SQL...