I am having diffuculty accounting for pauses. Does anyone have any ideas on how to remove the paused time from my $total_time?
$query4="SELECT * FROM job_log WHERE $table_id=table_id";
$last_value = "";
$result4=mysql_query($query4);
while($row4 = mysql_fetch_assoc($result4)) {
if ($action6=="Start Creation"){
$start_creation = $time_table4;}
if ($action6=="Start Table PTG"){
$start_table_ptg = $time_table4;}
if ($action6=="Cutting - Begin"){
$start_cutting_begin = $time_table4;}
if ($action6=="Begin 1st Proof"){
$start_begin_proof = $time_table4;}
if ($action6=="Proof Print - Begin"){
$start_print_proof_begin = $time_table4;}
if ($action6=="Start In-House Fix"){
$start_inhouse_fix = $time_table4;}
if ($action6=="Final Print - Begin"){
$start_final_print_begin = $time_table4;}
if ($action6=="Start Outside Change"){
$start_outside_change = $time_table4;}
elseif ($action6=="End Creation"){
$end_creation = $time_table4;
$sec = $end_creation - $start_creation;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="Finish Table PTG"){
$end_table_ptg = $time_table4;
$sec = $end_table_ptg - $start_table_ptg;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="Cutting - End"){
$end_cutting_end = $time_table4;
$sec = $end_cutting_end - $start_cutting_begin;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="End 1st Proof -OK"){
$end_proof_ok = $time_table4;
$sec = $end_proof_ok - $start_begin_proof;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="End 1st Proof - FIX"){
$end_proof_fix = $time_table4;
$sec = $end_proof_fix - $start_begin_proof;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="Proof Print - Finish"){
$end_print_proof_finish = $time_table4;
$sec = $end_print_proof_finish - $start_print_proof_begin;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="End In-House Fix"){
$end_inhouse_fix = $time_table4;
$sec = $end_inhouse_fix - $start_inhouse_fix;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="Final Print - End"){
$end_final_print_end = $time_table4;
$sec = $end_final_print_end - $start_final_print_begin;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
elseif ($action6=="End Outside Change"){
$end_outside_change = $time_table4;
$sec = $end_outside_change - $start_outside_change;
$hr = floor($sec/60/60);
$sec = $sec - $hr * 60 * 60;
$min = floor($sec/60);
$sec = $sec - $min * 60;
$total_time = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
echo "<center><table border = '0' cellspaceing = '0' cellpadding = '-1' width = '10%' bgcolor = '#999999'>";
echo "<tr><td align = 'center' width = '100%'>$total_time</td>";
echo "</tr></table></center>";}
else{
echo "";}
I need something along the lines of "if task had a pause then find resume for that task and subtract the amount of paused time"