Results 1 to 5 of 5

Thread: Looking for some MySQL Code (Altitude to FL)

  1. #1
    First officer nzradar's Avatar
    Join Date
    Apr 2011
    Location
    Palmerston North, New Zealand (T-NZPM21)
    Posts
    273

    Looking for some MySQL Code (Altitude to FL)

    Hi, with a percent chance of the low teens I'm looking for a way in MySQL code to report flight level from altitude. For the best part:

    concat("FL",left(altitude,3)) gets me what I need but when the altitude is reported as 40950 I'm really looking to round up to 41000 but can't seem to find a function for rounding up integer values.

    I'd appreciate any help, thanks.
    Michael
    Palmerston North,
    New Zealand
    ex-FR24 Feeder

  2. #2
    Super Moderator
    Join Date
    May 2011
    Location
    T-NZCH1, PP:PH New Zealand
    Posts
    4,813
    It may only help if you using basic PHP to display the outputs like me..

    I just put in another column in mine to test, with the native PHP round function used to get a result. Which you could then concant also. By default it rounds to halves but there are other parameters

    ".Round($rows['altitude'],-3)."

    Ends in result:

    FLtest.jpg
    Posts not to be taken as official support representation - Just a helpful uploader who tinkers

  3. #3
    First officer nzradar's Avatar
    Join Date
    Apr 2011
    Location
    Palmerston North, New Zealand (T-NZPM21)
    Posts
    273
    Thanks for the heads up on the PHP code, it may be a solution. I've currently got MySQL code:

    Code:
     left(round(max(altitude)/100,0),3)
    Michael
    Palmerston North,
    New Zealand
    ex-FR24 Feeder

  4. #4
    Super Moderator
    Join Date
    May 2011
    Location
    T-NZCH1, PP:PH New Zealand
    Posts
    4,813
    Yeah shortly after finding the PHP ver I noted a SQL ver of round. But wasn't sure how to impliment with our standard tables as such to get a new array field to play with
    Posts not to be taken as official support representation - Just a helpful uploader who tinkers

  5. #5
    Passenger mt007's Avatar
    Join Date
    Jun 2010
    Location
    LPPT
    Posts
    20
    Quote Originally Posted by nzradar View Post
    Thanks for the heads up on the PHP code, it may be a solution. I've currently got MySQL code:

    Code:
     left(round(max(altitude)/100,0),3)
    Hi Michael,
    how can i make for me some page like yours?

    Thanks very much.
    Regards,
    Last edited by Oblivian; 2016-03-31 at 18:11.
    Regards,
    Miguel Teixeira
    FR24 T-LPPT1 Radar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •