stuartpb Posted June 17, 2011 Report Share Posted June 17, 2011 I've expanded on the airport table add on, by adding seperate pages for each airport in the airport table. You just click on the ICAO code in each table row to open a new page with the airport details. I've put the total departures (total pireps by depicao) and total arrivals (total pireps by arricao) from the given airport in the airport details page, but I want to be able to show links to the last pirep filed both from and to the airport. So the links would be "show last departure" and "show last arrival", and the links would go to the relevant PIREP. Could anyone shed any light on this for me please? I've spent all day trying to get it to work, without success. Here's the airport table: http://execair.org/index.php/airports Cheers, Stuart Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 17, 2011 Report Share Posted June 17, 2011 Try this.... <?php $icao = 'KLAX'; $params = array( 'depicao' => $icao, 'accepted' => '1' ); $pireps = PIREPData::findPIREPS($params, 1); $deppirep = $pireps[0]; $params = array( 'arricao' => $icao, 'accepted' => '1' ); $pireps = PIREPData::findPIREPS($params, 1); $arrpirep = $pireps[0]; ?> Last Departure: <a href="<?php echo SITE_URL?>/index.php/pireps/viewreport/<?php echo $deppirep->pirepid;?>"> <?php echo $deppirep->code.$deppirep->flightnum.' ('.$deppirep->depicao.'-'.$deppirep->arricao.') '.$deppirep->firstname.' '.$deppirep->lastname?> </a> <br /> Last Arrival: <a href="<?php echo SITE_URL?>/index.php/pireps/viewreport/<?php echo $arrpirep->pirepid;?>"> <?php echo $arrpirep->code.$arrpirep->flightnum.' ('.$arrpirep->depicao.'-'.$arrpirep->arricao.') '.$arrpirep->firstname.' '.$arrpirep->lastname?> </a> Change the $icao to dynamic and it will work. It will pull the last PIREP and only accepted. If it pulls the first then you will need to change the order of your PIREP's in the local.config file Quote Link to comment Share on other sites More sharing options...
stuartpb Posted June 17, 2011 Author Report Share Posted June 17, 2011 That worked perfectly Jeff, thank you very much! Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted June 17, 2011 Report Share Posted June 17, 2011 NP 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.