Jump to content

Schedules Search


avdesigns

Recommended Posts

I have tried getting schedules with a min/max flight time but the problem is that you'll need to edit the getSchedules function. Instead I recommend you create a new one. It's best to make a new class for it, create a new file in core/common and call it something along the lines of ScheduleSearch.class.php. This way, when you update, it won't get overwritten.

Anyway, you could do this for the flight time:

public function getSchedulesByDuration($min, $max){
$sql = "SELECT * FROM ".TABLE_PREFIX."_schedules"; WHERE flighttime >= '".$min."' AND flighttime <= '".$max."';
return DB::get_results($sql);
}

Obviously you'll need to pass the min and max values in when you use it. As for the day of week:

public function getSchedulesByDayofWeek($dayofweek){
$sql = "SELECT * FROM ".TABLE_PREFIX."_schedules"; WHERE daysofweek LIKE '".$dayofweek."';
return DB::get_results($sql);
}

Remember that the value passed into that one must be a number, you could use a CASE or IF statement to assign each number to a day for the user to enter.

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