Jump to content

How to get aircraft icao knowing it's name


Recommended Posts

Posted

On my briefing page I have the following code which gives me aircraft's name from schedules:

<?php echo "{$schedule->aircraft}"; ?>

Which outputs something like this: A320-214

I can also use:

<?php echo "{$schedule->aircraftid}"; ?>

Which gives me an ID of an aircraft from *aircraft* table.

 

Knowing aircraft's name and id, how can I get aircraft icao code from *aircraft* database?

(In aircraft database there are fields *id*, *icao*, *name* etc)

Thanks!

Posted
<?php
$aircraft = OperationsData::getAircraftInfo($schedules->aircraftid);
echo $aircraft->icao;
?>

Change $schedules->aircraftid to the aircraft id of your table, provided the id's match between the aircraft table and your table then it should work.

  • Thanks 1

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