Jump to content

Recommended Posts

Posted

I've been tinkering in the operationsdata.class (and forums search of course) but haven't had any luck - I would like to sort the airports list by name instead of ICAO.

Also, is there a way to display only the airports currently being used by the schedules? If I drop airports from the database that are seasonal or discontinued it throws off pirep data so I would like to keep them but not show up in the search's drop-down menu.

  • Moderators
Posted

Okay. For that, you would write a code as a function like this and place it in the OperationsData.class.php::

public function airports()
{
$sql = "SELECT * FROM phpvms_airports ORDER by id ";
return DB::get_results($sql);
}

Then you will need to call the function like this:

$airports = OperationsData::airports();

Now you need to set it in a loop lik this:

<?php
foreach($airports as $airport)
{
echo $airport->name;
}

I don't know where you want to use this but this is basically the way. :D

For your second request, you would do it like above instead, you have to change this part:

$sql = "SELECT * FROM phpvms_airports ORDER by id ";

To this:

$sql = "SELECT DISTINCT depicao, arricao FROM phpvms_schedules ORDER by id ";

Remember using above, will limit your query to depicao and arricao only, so you only have option to echo these 2.(ex. $airport->depicao, $airport->arricao).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...