while (@row = $sth->fetchrow()){ $total_hours = $row[4]; $total_minutes = $row[5]; print < $print_date $row[1] $in_time $out_time $row[4]:$row[5] HTML } # End of while.