changing flight class time retrieval method
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 18 Apr 2016 20:09:38 +0000 (16:09 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 18 Apr 2016 20:09:38 +0000 (16:09 -0400)
class_flight.php

index bd2371c..db1ec66 100644 (file)
@@ -97,24 +97,24 @@ include_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php' );
                                if ($row['name'] == "EXPRESS AIRLINES 1, INC.") $this->arr_data[$key]['name'] = 'Delta Airlines';
                                if ($row['airline'] == "EXPRESS AIRLINES 1, INC.") $this->arr_data[$key]['airline'] = 'Delta Airlines';
                        }
-                       foreach( $this->dep_data as $key)
+                       foreach( $this->dep_data as $key=>$value)
                        {
-                               $update_times[] = strtotime($row['msg_dtm']);
+                               $update_times[] = strtotime($value['msg_dtm']);
                                if ($row['name'] == "EXPRESS AIRLINES 1, INC.") $this->dep_data[$key]['name'] = '<nobr>Delta Airlines</nobr>';
                                if ($row['airline'] == "EXPRESS AIRLINES 1, INC.") $this->dep_data[$key]['airline'] = '<nobr>Delta Airlines</nobr>';
                        }
                        rsort($update_times);
                        // get UTC offset for current date/time
                        $TimeDiff = 4+date("I");
-//                     $this->last_updated = '<div id="last-update"><p>&nbsp;</p><p><b>Last updated:</b> '.date("n/j/Y g:i a",$update_times[0]-($TimeDiff*60*60)).'</p></div>';
-            $query = "SELECT msg_dtm FROM glm_flight
-                        ORDER BY msg_dtm DESC
-                        LIMIT 1;";
-            $results = $wpdb->get_results($query, ARRAY_A);
-            foreach($results as $key=>$value){
-                $lastUpdated = date("n/j/Y g:i a", strtotime($value['msg_dtm']) - ($TimeDiff*60*60));
-            }
-            $this->last_updated = '<div id="last-update"><p>&nbsp;</p><p><b>Last updated:</b> '. $lastUpdated . '</p></div>';
+                       $this->last_updated = '<div id="last-update"><p>&nbsp;</p><p><b>Last updated:</b> '.date("n/j/Y g:i a",$update_times[0]-($TimeDiff*60*60)).'</p></div>';
+            // $query = "SELECT msg_dtm FROM glm_flight
+            //             ORDER BY msg_dtm DESC
+            //             LIMIT 1;";
+            // $results = $wpdb->get_results($query, ARRAY_A);
+            // foreach($results as $key=>$value){
+            //     $lastUpdated = date("n/j/Y g:i a", strtotime($value['msg_dtm']) - ($TimeDiff*60*60));
+            // }
+            // $this->last_updated = '<div id="last-update"><p>&nbsp;</p><p><b>Last updated:</b> '. $lastUpdated . '</p></div>';
                        //echo '<!--<pre>';
                        //print_r( $update_times );
                        //echo '</pre>-->';