Jetwave Posted October 7, 2012 Report Share Posted October 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 7, 2012 Moderators Report Share Posted October 7, 2012 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. 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). Quote Link to comment Share on other sites More sharing options...
Jetwave Posted October 9, 2012 Author Report Share Posted October 9, 2012 Thanks for the help I'll let you know how it works out! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.