artem Posted January 12, 2019 Report Posted January 12, 2019 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! Quote
web541 Posted January 12, 2019 Report Posted January 12, 2019 Is this what you're looking for? <?php echo OperationsData::getAircraftInfo($schedules->aircraftid); ?> <?php echo OperationsData::getAircraftByName($schedules->aircraft); ?> Quote
artem Posted January 12, 2019 Author Report Posted January 12, 2019 @web541 I'm looking for a script which will give me ICAO code of an aircraft from *aircraft* table knowing it's *id* from a different table Quote
web541 Posted January 12, 2019 Report Posted January 12, 2019 <?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. 1 Quote
artem Posted January 12, 2019 Author Report Posted January 12, 2019 That's awesome! Thanks a lot!!! Quote
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.