Hello, I have the following piece of code:
$query_hours = "SELECT sec_to_time(sum(time_to_sec(t2.duration))) AS duration_sum FROM pilots t1, reports t2 WHERE t1.pilot_id=$id AND t1.pilot_id=t2.pilot_id";
$result_hours = mysql_query($query_hours);
if (mysql_numrows($result_hours) > 0) {
$time = mysql_result($result_hours,0,"duration_sum");
}
if ($time < "50") {
$pay = $time * 50;
} elseif ($time >= "50") {
$pay = $time * 55;
} elseif ($time >= "100") {
$pay = $time * 65;
} elseif ($time >= "200") {
$pay = $time * 75;
} elseif ($time >= "350") {
$pay = $time * 90;
}
But the problem is is that $time is in hh:mm:ss format and I need to somehow convert it to hours or else $pay always equals 0. How can this be achieved? Any and all help is appreciated.
Thanks,
Darko