Jump to content

search flight by distance range


ARV187

Recommended Posts

I would like to add an option to allow you to search for a flight that has for example between 200 miles and 300 miles
something similar to: search flight where 'distance' between "$distance1" and "$distance2"

I have scanned these files:

  • schedule_searchform.tpl
  • core/modules/Schedules/schedules.php

but I can not find out what code I need to do this.

Link to comment
Share on other sites

  • Administrators

What version of phpVMS?

Does your schedule search already show an option for greater than/less than? If so, look in /core/common/SchedulesData.class.php around line 322 for distanceBetweenPoints function. This will give an idea how that function works and help you write a new function to do exactly what you want. You would also need to add to /core/templates/schedule_searchform.php so the pilot has the option to search by a distance range.

Link to comment
Share on other sites

v2.1.936 version, I saw that function, but I don't figure that do with that, the function calculate the distance between two points.
I can do that in phpmyadmin with a sql sentence, but I do not know how to move it to that in schedule_searchform distances section with the existing form, where the data of the query "between" are those that the user enters in two fields type number.

 

<div id="distance">
		<p>Selecciona distancia:</p>
		<select id="type" name="type">
			<option value="greater">Greater than</option>
			<option value="less">Less than</option>            
		</select>
		<input type="text" name="distance" value="" />        
		<input type="submit" name="submit" value="Search flight" />
<br /><br />
			<option value="between">Between</option>
        		<?php $sql = "SELECT *  FROM `phpvms_schedules` WHERE `distance` BETWEEN $distance1 AND $distance2"; ?>
        <input type="number" name="distance1" min="1" max="9999" value="" /> > <input type="number" name="distance2" min="1" max="9999" value="" />
        <input type="submit" name="submit" value="Search flight" />
</div>

 

Edited by ARV187
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...