Omerr01 Posted December 29, 2016 Report Share Posted December 29, 2016 Hello, I want to know if I can know if the flight with ACARSData::get_flight($code, $flight_num), Is in flight or not, Beacuse in my code, I want to search some flight and check if the flight is in flight and get some details about the flight, I tried to do this one, $results = ACARSData::GetACARSData(); echo $results->aircraft; But it didn't give me noting, I already tought about the foreach option but i'm inside while and if i do the foreach it will change me something that I don't won't to change, And when I did this one: $results = ACARSData::get_flight($code, $flight_num), echo $results->aircraft; It gave me all the details that I want but it's not in-flight so it dons't help me. So I wanted to know if I can do ACARSData::GetACARSData($code, $flight_num); or something else that can give me some detiled about specific flight that i want to search. Thanks for the helpers. Quote Link to comment Share on other sites More sharing options...
web541 Posted December 29, 2016 Report Share Posted December 29, 2016 ACARSData::getACARSData() will return an array, therefore you will have to loop it through but it will return all results. Do you want to search for an active ACARS flight or a PIREP or a schedule, they are all very different. You could modify the GetACARSData function to fetch only one row instead of retrieving all results. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted December 29, 2016 Moderators Report Share Posted December 29, 2016 (edited) In you "ACARSData.class.php" file add the following function: public static function GetFlightData($flightnum) { $sql = "SELECT * FROM phpvms_acarsdata WHERE flightnum = "$flightnum"; return DB::get_row($sql); } Now in ACARS table the flight number is not separated meaning there is only one column for flight number containing flight code and flight number combined together. In order for the function above to work, the flight code and flight nuber must be combined into one variable then passed to the function. Try the following inside your while-loop: $flightnum = {$code.$flight_num}; $flight = ACARSData::GetFlightData($flightnum); $aircraft = $flight->aircraft; echo $aircraft; This is not tested, so give it a shot I'm pretty sure it'll work. Edited December 29, 2016 by Parkho 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.