For example, from HTML post in a module, an example would be:
$params = array(
's.depicao' => $this->post->depicao,
);
// The 10 will return the first 10 results found
$schedules = SchedulesData::findSchedules($params, 10);
Syntax is ('s.columnname' => 'value'), where value can be an array is multiple values, or with a SQL wildcard (%) if that's what is desired.
Columns from the schedules table should be prefixed by 's.', the aircraft table as 'a.', so searches on related information can be done.
You can also pass offsets ($start and $count) in order to facilitate pagination.
/* Find any flights departing from either KJFK or LFPG
and arriving at either KBOS or KIAD */
$params = array(
's.depicao' => array ('KJFK', 'LFPG'),
's.arricao' => array ('KBOS', 'KIAD'),
's.enabled' => 1,
);
$schedules = SchedulesData::findSchedules($params);
/* Find any flights using B747-400s and departing from KJFK,
with a flight distance of more than 100 */
$params = array(
'a.name' => 'B747-400',
's.depicao' => 'KJFK',
's.distance' => '> 100',
);
$schedules = SchedulesData::findSchedules($params);
// You can then do:
foreach($schedules as $sched)
{
echo "Flight is {$sched->code}{$sched->flightnum}";
// do whatever else you want in here
}
Search for PIREPS
There is a function, which works the same as above:
Recommended Comments
There are no comments to display.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.