# statistics help \[SOLVED\]

**URL:** <https://forum.phpvms.net/t/statistics-help-solved/4424>\
**Category:** phpVMS Legacy Support (v2/v5)\
**Created:** [April 2, 2011, 4:55am UTC](https://forum.phpvms.net/t/statistics-help-solved/4424 "2011-04-02T04:55:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 4:55am UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/1 "2011-04-02T04:55:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nuclear](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nuclear/32/90_2.png) [@Nuclear](https://forum.phpvms.net/u/Nuclear)\
**Post date:** [April 2, 2011, 11:50am UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/2 "2011-04-02T11:50:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 2:47pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/3 "2011-04-02T14:47:04Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Nuclear](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nuclear/32/90_2.png) [@Nuclear](https://forum.phpvms.net/u/Nuclear)\
**Post date:** [April 2, 2011, 3:44pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/4 "2011-04-02T15:44:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kyle](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/k/848f3c/32.png) [@Kyle](https://forum.phpvms.net/u/Kyle)\
**Post date:** [April 2, 2011, 4:02pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/5 "2011-04-02T16:02:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 4:18pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/6 "2011-04-02T16:18:53Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.phpvms.net/u/Tom)\
**Post date:** [April 2, 2011, 4:20pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/7 "2011-04-02T16:20:37Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Nuclear](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nuclear/32/90_2.png) [@Nuclear](https://forum.phpvms.net/u/Nuclear)\
**Post date:** [April 2, 2011, 4:26pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/8 "2011-04-02T16:26:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 4:29pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/9 "2011-04-02T16:29:06Z")

</div>

I think it somehow takes into account my cargo flights as pax too

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.phpvms.net/u/Tom)\
**Post date:** [April 2, 2011, 4:31pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/10 "2011-04-02T16:31:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 4:33pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/11 "2011-04-02T16:33:55Z")

</div>

Ahh finally

Then I have to remove that Total Pax thingy from my main page.

Cheers,

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.phpvms.net/u/Tom)\
**Post date:** [April 2, 2011, 4:39pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/12 "2011-04-02T16:39:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 5:34pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/13 "2011-04-02T17:34:49Z")

</div>

Hmm. We use same name different flight number. But I think later I will change the freighter codes to something else.

Thank you.

---

<div class="post-metadata">

**Author:** ![Nuclear](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nuclear/32/90_2.png) [@Nuclear](https://forum.phpvms.net/u/Nuclear)\
**Post date:** [April 2, 2011, 6:14pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/14 "2011-04-02T18:14:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 6:35pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/15 "2011-04-02T18:35:20Z")

</div>

Yay! Thank you so much Michael

---

<div class="post-metadata">

**Author:** ![Nuclear](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nuclear/32/90_2.png) [@Nuclear](https://forum.phpvms.net/u/Nuclear)\
**Post date:** [April 2, 2011, 6:41pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/16 "2011-04-02T18:41:46Z")

</div>

You’re welcome

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 2, 2011, 7:00pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/17 "2011-04-02T19:00:42Z")

</div>

I just would like to ask if this topic can be marked as SOLVED.

I don’t know how to do that.

Cheers,

---

<div class="post-metadata">

**Author:** ![Tom](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@Tom](https://forum.phpvms.net/u/Tom)\
**Post date:** [April 2, 2011, 7:02pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/18 "2011-04-02T19:02:13Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![airmermaid](https://forum.phpvms.net/user_avatar/forum.phpvms.net/airmermaid/32/123_2.png) [@airmermaid](https://forum.phpvms.net/u/airmermaid)\
**Post date:** [April 3, 2011, 7:14am UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/19 "2011-04-03T07:14:20Z")

</div>

Thanks Tom.

I must remember using the full edit mode instead of fast reply

---

<div class="post-metadata">

**Author:** ![nabeel](https://forum.phpvms.net/user_avatar/forum.phpvms.net/nabeel/32/2971_2.png) [@nabeel](https://forum.phpvms.net/u/nabeel)\
**Post date:** [April 3, 2011, 9:07pm UTC](https://forum.phpvms.net/t/statistics-help-solved/4424/20 "2011-04-03T21:07:04Z")

</div>

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

[Next page](https://forum.phpvms.net/t/statistics-help-solved/4424.md?page=2)
