Jump to content

Custom mile input


lukasc24

Recommended Posts

Hi, if I want to allow pilots to enter a custom amount of miles (if they have a multiplier or something)
1. would this work?

$sql = 'SELECT
SUM(distance) AS distance
FROM '.TABLE_PREFIX.'pireps
WHERE pilotid = '.$pilotid;

$info = DB::get_row($sql);

echo $info->distance;

 

and 2. how could I get a PIREP field that would change the total miles for pilots

thanks

Link to comment
Share on other sites

Hi lukas! 

 

Can explain briefly what you mean by custom miles? Is it based on searching ? Meaning pilots will put their miles input and use for searching? 

 

2nd, if you want to get a total miles of a pirep field you need to do maths. Never disturb the current database. 

Link to comment
Share on other sites

Hello,
What I mean by that is, right now, my CC is just using the standard distance calculations, meaning the mile you earn just com from how far the 2 airports are, I want pilots to be able to log flights with the exact amount of miles they flew (if their fpl added a couple hundred miles or if the flight has a multiplier like with an event or something like that)

Thanks

Link to comment
Share on other sites

Multiplier is another database i suppose. You need to code the multiplier along with the pireps of the pilots. To assign if the schedule has a multiplier is another system. 

 

If you meant pilots adding the number of miles manually, just use insert sql or update. However, if you really want all those multiplier, and all it is better to build another system or module to handle the multiplier and miles

Link to comment
Share on other sites

It is a quite complicated system you want, as you would have to link the sum to the navdata table and get it to figure out the distance between waypoints and add them up together. You would also have to hope it doesn't get the wrong waypoint and give a wrong outcome. You would have to talk to the maker of simbrief how he has gotten it to work, this could be a fairly long piece of code at the end of the day. and if you are new to it, I would suggest staying with what you have at the moment, and learn more about it and code simpler modules first.

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