Hello
In my statistics on main page I have tried to add a “totat passengers carried” field. To my surprise the number shown was unbelieveable.
According to it my airline has carried around 104000 passengers with only 27 flights. Which makes around 3800 persons per flight.
I took the data from …/core/common/StatsData.class.php (field is TotalPaxCarried). Am I looking at wrong place for that data?
I also would like to know if there’s a way to add Total Cargo Carried because my airline has a cargo section too.
Cheers,
Arslan
I just tested it and it returned a reasonable value for me (2945 pax for 38 flights). Can you post the actual code you’re using?
As for the total cargo, I don’t see any built-in methods for that. You’d have to write an SQL query to sum the ‘load’ field for all filed PIREPs.
1 Like
I just tested it and it returned a reasonable value for me (2945 pax for 38 flights). Can you post the actual code you’re using?
As for the total cargo, I don’t see any built-in methods for that. You’d have to write an SQL query to sum the ‘load’ field for all filed PIREPs.
This is the part of Total Pax Carried (which I deleted)
<tt>Total Passengers Carried: </tt><?php echo StatsData::TotalPaxCarried(); ?><br />
For the cargo thingy I will pass as I don’t know this coding stuff and don’t want to mess with SQL
Try passing the airline: StatsData::TotalPaxCarried(‘MER’)
That’s how I tested it, see if it makes a difference. According to the documentation, passing the airline is optional, so I assume by not passing anything it returns the total for all airlines (which should be the same value if you only have one airline), but either I’m wrong or there’s a bug in the method.
Kyle
April 2, 2011, 4:02pm
5
Hey Michael,
Just to clear up, I don’t think you need the 's in in the VA code.
It should be done like that..
<?php echo StatsData::TotalPaxCarried(MER); ?>
and it will return the data in order of an VA.
Hey Michael,
Just to clear up, I don’t think you need the 's in in the VA code.
It should be done like that..
<?php echo StatsData::TotalPaxCarried(MER); ?>
and it will return the data in order of an VA.
Told you, I was doing something weird.
Thanks guys.
But it still is the same
Total Pax Carried: 104643
Tom
April 2, 2011, 4:20pm
7
Hey Michael,
Just to clear up, I don’t think you need the 's in in the VA code.
It should be done like that..
Technically you should have them I believe, but it doesn’t really matter
Hey Michael,
Just to clear up, I don’t think you need the 's in in the VA code.
It should be done like that..
<?php echo StatsData::TotalPaxCarried(MER); ?>
and it will return the data in order of an VA.
I just tested it again and it works either with or without the quotes. I also tested StatsData::TotalPaxCarried() without passing any arguments and it still returned the same value (2945), so I’m not sure what’s wrong with the OP.
I think it somehow takes into account my cargo flights as pax too
Tom
April 2, 2011, 4:31pm
10
I think it somehow takes into account my cargo flights as pax too
It does. Pax and cargo aren’t stored separately, they’re just stored in ‘load’ - this function just adds it all up.
Ahh finally
Then I have to remove that Total Pax thingy from my main page.
Cheers,
Tom
April 2, 2011, 4:39pm
12
Ahh finally
Then I have to remove that Total Pax thingy from my main page.
Cheers,
Well, if you’re using separate airline codes for pax and cargo (which from reading your about page it looks so) you can just use <?php echo StatsData::TotalPaxCarried(MER); ?> for pax and <?php echo StatsData::TotalPaxCarried(somethingelse); ?> for cargo.
Hmm. We use same name different flight number. But I think later I will change the freighter codes to something else.
Thank you.
Well, there is a way to do it using SQL:
$query="SELECT SUM(`load`) as totalpax FROM `phpvms_pireps` WHERE `flighttype`='P'";
$result=DB::get_results($query);
echo $result[0]->totalpax;
This sums up the load for passenger flights only. This assumes that you have your cargo routes set as cargo flights.
Yay! Thank you so much Michael
I just would like to ask if this topic can be marked as SOLVED.
I don’t know how to do that.
Cheers,
Tom
April 2, 2011, 7:02pm
18
I just would like to ask if this topic can be marked as SOLVED.
I don’t know how to do that.
Cheers,
If you go and edit the first post you can add [sOLVED] to the topic title
Thanks Tom.
I must remember using the full edit mode instead of fast reply
nabeel
April 3, 2011, 9:07pm
20
I just looked at the code, it only pulls the PAX type of ‘P’, so passenger flights.
Make sure you haven’t inadvertantly set a cargo flight to a pax type