Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function syndicate_flight_time($cxn) {
- $Syndicate = $_SESSION['Syndicate'];
- $sql = "SELECT Landing, Take_Off FROM flight_log WHERE Syndicate_Name = '$Syndicate'";
- $result = mysqli_query($cxn,$sql)
- or die ("Can't collect Group Take Off and Landing times");
- while($row = mysqli_fetch_assoc($result)) {
- $difference = (strtotime($row['Landing']) - strtotime($row['Take_Off']));
- $total_diff += $difference;
- $hours = floor($difference/60/60); // rounds the hours to the nearest hour.
- $minutes = (($difference - ($hours * 60 * 60))/60); // rounds the remainder of the hours to the nearest minutes.
- $time = $hours.":".$minutes; // puts a : between the hours and minutes.
- echo '<br />'.$time;
- }
- }
- $total_hours = floor($total_diff/60/60); // rounds the hours to the nearest hour.
- $minutes = (($total_diff - ($total_hours * 60 * 60))/60); // rounds the remainder of the hours to the nearest minutes.
- $total_time = $hours.":".$minutes; // puts a : between the hours and minutes.
- echo "total time:".$total_time;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement