Jump to content

Few Questions About: ACARSData::


Omerr01

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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 by Parkho
Link to comment
Share on other sites

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...