# Request:  Flight Board

**URL:** <https://forum.phpvms.net/t/request-flight-board/2595>\
**Category:** Development Help\
**Created:** [May 5, 2010, 1:13pm UTC](https://forum.phpvms.net/t/request-flight-board/2595 "2010-05-05T13:13:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 5, 2010, 1:13pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/1 "2010-05-05T13:13:56Z")

</div>

Is it possible to have a flight board that first checks the system time and then displays the following.

Flight Number - Departure ICAO - Arrival - Aircraft - Status

This would be eye candy, rather than actual status, since most of us have more flights than pilots. The board would display only flights with an arrival time within 2 hours of system time. Flight status would, depending onwhere they are in relation to system time, be on time, arriving, arrived.

I suppose something similar could be done for departures, but I’m trying to keep it as simple as possible.

Does this sound like something that could be done? Or, maybe I should ask if it has already been done.

---

<div class="post-metadata">

**Author:** ![joshua.john](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/j/e79b87/32.png) [@joshua.john](https://forum.phpvms.net/u/joshua.john)\
**Post date:** [May 6, 2010, 12:32pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/2 "2010-05-06T12:32:41Z")

</div>

> Is it possible to have a flight board that first checks the system time and then displays the following.
> 
> Flight Number - Departure ICAO - Arrival - Aircraft - Status
> 
> This would be eye candy, rather than actual status, since most of us have more flights than pilots. The board would display only flights with an arrival time within 2 hours of system time. Flight status would, depending onwhere they are in relation to system time, be on time, arriving, arrived.
> 
> I suppose something similar could be done for departures, but I’m trying to keep it as simple as possible.
> 
> Does this sound like something that could be done? Or, maybe I should ask if it has already been done.

Sounds like a good idea! hopefully it can be done

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 6, 2010, 1:04pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/3 "2010-05-06T13:04:30Z")

</div>

Don’t laugh, but I am trying to do it. Looking at code from other pages, trying to figure out what variable names I need, with one eye on the monitor and the other on a book on PHP. The results, so far are either infuriating or hysterically funny. I don’t know which is worse. My approach is this:

Get the system time and convert it to the 24 hour format I’m using in the routes.

Get the routes with arrival times that are equal to or plus/minus one hour to the system time.

Display those routes in a table with flight number, departure and arrival ICAOs, a/c tail number and verbiage based on how far from the system time the arrival time is.

---

<div class="post-metadata">

**Author:** ![MrAmsterdam](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mramsterdam/32/20_2.png) [@MrAmsterdam](https://forum.phpvms.net/u/MrAmsterdam)\
**Post date:** [May 6, 2010, 1:17pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/4 "2010-05-06T13:17:51Z")

</div>

Sounds cool!!

Hope you will be succesful !

Regards,

Lucas

---

<div class="post-metadata">

**Author:** ![joshua.john](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/j/e79b87/32.png) [@joshua.john](https://forum.phpvms.net/u/joshua.john)\
**Post date:** [May 6, 2010, 2:30pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/5 "2010-05-06T14:30:24Z")

</div>

> Don’t laugh, but I am trying to do it. Looking at code from other pages, trying to figure out what variable names I need, with one eye on the monitor and the other on a book on PHP. The results, so far are either infuriating or hysterically funny. I don’t know which is worse. My approach is this:
> 
> Get the system time and convert it to the 24 hour format I’m using in the routes.
> 
> Get the routes with arrival times that are equal to or plus/minus one hour to the system time.
> 
> Display those routes in a table with flight number, departure and arrival ICAOs, a/c tail number and verbiage based on how far from the system time the arrival time is.

Is this what you want to do?

[http://xlvirtualairways.simmiles.com/arrivals.php](http://xlvirtualairways.simmiles.com/arrivals.php)

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 6, 2010, 2:58pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/6 "2010-05-06T14:58:26Z")

</div>

Similar, but instead of the last two columns, a column with verbiage such as on time, arriving, landed, arrived (based on schedule time vs. system time). That way, any time the page was loaded, different flights would be displayed. A departure board could be done similarly, with different status verbiage.

---

<div class="post-metadata">

**Author:** ![joshua.john](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/j/e79b87/32.png) [@joshua.john](https://forum.phpvms.net/u/joshua.john)\
**Post date:** [May 6, 2010, 3:55pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/7 "2010-05-06T15:55:43Z")

</div>

> Similar, but instead of the last two columns, a column with verbiage such as on time, arriving, landed, arrived (based on schedule time vs. system time). That way, any time the page was loaded, different flights would be displayed. A departure board could be done similarly, with different status verbiage.

Well im defo interested. Something like that would be good

---

<div class="post-metadata">

**Author:** ![MrAmsterdam](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mramsterdam/32/20_2.png) [@MrAmsterdam](https://forum.phpvms.net/u/MrAmsterdam)\
**Post date:** [May 7, 2010, 7:42am UTC](https://forum.phpvms.net/t/request-flight-board/2595/8 "2010-05-07T07:42:32Z")

</div>

Yeah!

I would definately like this!

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.phpvms.net/u/Tom)\
**Post date:** [May 7, 2010, 1:01pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/9 "2010-05-07T13:01:38Z")

</div>

If you don’t mind I might have a go at this one also, I’ve been thinking about it for a while and have a good idea to make it realistic looking.

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 7, 2010, 1:59pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/10 "2010-05-07T13:59:22Z")

</div>

I certainly don’t mind, Tom, but you might want to look at this, before reinventing the wheel.

EDIT: That software won’t serve my needs. Back to trying to write code.

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [May 8, 2010, 12:29pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/11 "2010-05-08T12:29:28Z")

</div>

This is a pretty dirty way to do it (the sql query’s really need to be in a data class, not in the page) but you could build a module around it

```
<?php
$query = "SELECT * FROM phpvms_schedules ORDER BY arrtime + 0 ASC";
$list = DB::get_results($query);
echo '<h3>Upcoming Arrivals - Current Time is '.date('G:i').'</h3>';
echo '<table width="100%" border="1">';
echo '<tr><td>Departure</td><td>Arrival</td><td>Arrival Time</td><td>Aircraft</td><td>Status</td></tr>';
$count = 0;
foreach($list as $flight)
{
   if(($flight->arrtime + 0) > date('G:i'))
   {
       if($count < 5)
       {
           $aircraft = OperationsData::getAircraftInfo($flight->aircraft);
           echo '<tr><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>';
           echo '<td>';
           if(($flight->arrtime - date('G:i')) <= 1)
           {
               echo 'Arriving Soon';
           }
           else
           {
               echo 'In Flight';
           }
           echo '</td></tr>';
           $count++;
       }
   }
}
echo '</table>';
?>

```

This will show the next 5 flights scheduled to arrive and is written to work with 24 hour date format, so if you are using 12 hour date format with am/pm in your schedules you will have to modify the date function.

It should look something like

Pretty plain but you can build it up how you would like and skin it.

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 8, 2010, 1:51pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/12 "2010-05-08T13:51:36Z")

</div>

Wow! That is what I’m looking for. Will give it a try and see if I can get it to work here. Thanks.

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 8, 2010, 7:47pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/13 "2010-05-08T19:47:56Z")

</div>

I wish I could report I’ve got it working, but if that happened, whatever would I do for the rest of the day.

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [May 9, 2010, 1:39am UTC](https://forum.phpvms.net/t/request-flight-board/2595/14 "2010-05-09T01:39:11Z")

</div>

> I wish I could report I’ve got it working, but if that happened, whatever would I do for the rest of the day.

Is there any output at all? Do you have any schedules or aircraft? It works for me here on ver 934. If there is any error please post it.

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 9, 2010, 5:37am UTC](https://forum.phpvms.net/t/request-flight-board/2595/15 "2010-05-09T05:37:49Z")

</div>

I’ve obviously missed something I need to do, because it is only echoing the variables and some of the code. I don’t know my you know what from my elbow, when it comes to php.

This is the output I get. I obviously have failed to do something necessary. I have about 30 aircraft and 700 routes. I’ve spent all day adding routes, so at this point I can’t see straight. I’ll look at this again in the morning to see if I can figure what I screwed up.

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [May 9, 2010, 9:59am UTC](https://forum.phpvms.net/t/request-flight-board/2595/16 "2010-05-09T09:59:20Z")

</div>

Hi, It looks looke you are adding this via the add page in the admin section, just add the code in to the frontpage\_main,tpl, when i tried earlier nothing was displayed in the table ill have another look at it again because like the post says its great eye candy

---

<div class="post-metadata">

**Author:** ![mark1million](https://forum.phpvms.net/user_avatar/forum.phpvms.net/mark1million/32/15_2.png) [@mark1million](https://forum.phpvms.net/u/mark1million)\
**Post date:** [May 9, 2010, 10:04am UTC](https://forum.phpvms.net/t/request-flight-board/2595/17 "2010-05-09T10:04:37Z")

</div>

How strange is that, i have just done it again and its populated, it could be something to do with the time though, last night it was23:45 when i tried today its 11:04, ill let you know when it get to 13:00 if it still works.

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [May 9, 2010, 11:43am UTC](https://forum.phpvms.net/t/request-flight-board/2595/18 "2010-05-09T11:43:18Z")

</div>

> I’ve obviously missed something I need to do, because it is only echoing the variables and some of the code. I don’t know my you know what from my elbow, when it comes to php.
> 
> This is the output I get. I obviously have failed to do something necessary. I have about 30 aircraft and 700 routes. I’ve spent all day adding routes, so at this point I can’t see straight. I’ll look at this again in the morning to see if I can figure what I screwed up.

Remember that this is php coding - it needs to be enclosed in php tags - ie \<?php and ?\>

I have changed the original post to include them - sorry.

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [May 9, 2010, 11:52am UTC](https://forum.phpvms.net/t/request-flight-board/2595/19 "2010-05-09T11:52:20Z")

</div>

> How strange is that, i have just done it again and its populated, it could be something to do with the time though, last night it was23:45 when i tried today its 11:04, ill let you know when it get to 13:00 if it still works.

If this is what you guys are looking for I will have to mess with it a little. Right now it is just looking for upcoming flights between the current time and midnight, it does not look “around the corner” until after midnight.

---

<div class="post-metadata">

**Author:** ![CrashGordon](https://forum.phpvms.net/user_avatar/forum.phpvms.net/crashgordon/32/34_2.png) [@CrashGordon](https://forum.phpvms.net/u/CrashGordon)\
**Post date:** [May 9, 2010, 1:47pm UTC](https://forum.phpvms.net/t/request-flight-board/2595/20 "2010-05-09T13:47:06Z")

</div>

> Remember that this is php coding - it needs to be enclosed in php tags - ie \<?php and ?\>
> 
> I have changed the original post to include them - sorry.

I’m as dumb as I look. I forgot to add the tags. Now, it works.

[Next page](https://forum.phpvms.net/t/request-flight-board/2595.md?page=2)
