# Schedules Results page \[SOLVED\]

**URL:** <https://forum.phpvms.net/t/schedules-results-page-solved/4455>\
**Category:** phpVMS Legacy Support (v2/v5)\
**Created:** [April 7, 2011, 9:52pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455 "2011-04-07T21:52:52Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 7, 2011, 9:52pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/1 "2011-04-07T21:52:52Z")

</div>

Hi everyone. I am working on yet another little project that I could use a hand with.

In the schedule results.tpl file, I have added the following to show what type of flight it is, Cargo, Passenger, or charter.

```
<?php echo ($route->flighttype=='') ? '' : '<strong>Flight Type: </strong>'.$route->flighttype.'<br />' ?>

```

Now I am curious. Can an if statement be included so say if flghttype = C echo Cargo?

Right now the way I have it, it simply shows the results as C, P, or H.

I would like to add another code like the one above to show how much it pays for that flight but have yet to get that one to work. Maybe I can ix the code from the schedules are in the admin panel?

So in all, the schedule results page would show on the left like

SYX1067 (KMKE - KSDF)

Departure: 8:05 AM CDT Arrival: 10:45 AM EDT

Equipment: B1900D (N801SK) Distance: 303.318nm

Days Flown: T W Th F

Flight Type: Charter

Pay for Flight: $765

---

<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 7, 2011, 11:35pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/2 "2011-04-07T23:35:50Z")

</div>

Yes, you could use a series of **if** statements:

```
<?php echo 'Flight Type: ';
if($route->flighttype=='P')
  echo 'Passenger<br />';
elseif($route-flighttype=='C')
  echo 'Cargo<br />';
...?>

```

You can also use a **switch** statement:

```
<?php echo 'Flight Type: ';
switch($route->flighttype)
{
  case 'C':
     echo 'Cargo<br />';
     break;
  case 'P':
     echo 'Passenger<br />';
     break;
  ...
}?>

```

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 8, 2011, 12:23am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/3 "2011-04-08T00:23:43Z")

</div>

The top one actually works out pretty good as far as the passengers part goes. It seems to ignore the Cargo and charter flights.

If you have any ideas, I am game to try. I am also working on this as we speak. If I get it to work, I will let you know.

Thanks for helping out on this one.

Ray

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 8, 2011, 12:27am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/4 "2011-04-08T00:27:44Z")

</div>

Ok so I tweaked it a tad and now I got it to echo charter as well, issue is, I did away with the elseif and went with another else echo and now all non passenger flights show up as Charter. I had figured that was going to be the result but tried it anyhow.

```
<?php echo '<strong>Flight Type: </strong>';
           if($route->flighttype=='P')
           echo 'Passenger<br />';
              elseif($route-flighttype=='C')
                 echo 'Cargo<br />';
		   else echo 'Charter<br />'; ?>

```

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 8, 2011, 12:43am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/5 "2011-04-08T00:43:58Z")

</div>

Got it!

I had a typo. I debugged it and now she works.

```
<?php echo '<strong>Flight Type: </strong>';
           if($route->flighttype=="P"){
                  echo "Passenger<br />";
           } elseif($route->flighttype=="C"){
                  echo "Cargo<br />";
		  } else { echo "Charter<br />"; 
			}
		?>

```

Now if Nabeel or some kind soul would chime in and tell us how to pull up the Flight Value part, I would be happier then could possibly be.

Thanks for pointing me down the right path Nuclear.

---

<div class="post-metadata">

**Author:** ![Jeff](https://forum.phpvms.net/user_avatar/forum.phpvms.net/jeff/32/78_2.png) [@Jeff](https://forum.phpvms.net/u/Jeff)\
**Post date:** [April 8, 2011, 3:06am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/6 "2011-04-08T03:06:50Z")

</div>

```
<td align = "center">$<?php echo $result->price;?></td>

```

Try this Ray. Tis is what I use to show the price of my flights on the results page.

---

<div class="post-metadata">

**Author:** ![Jeff](https://forum.phpvms.net/user_avatar/forum.phpvms.net/jeff/32/78_2.png) [@Jeff](https://forum.phpvms.net/u/Jeff)\
**Post date:** [April 8, 2011, 3:23am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/7 "2011-04-08T03:23:40Z")

</div>

Actually, this one might work better for you…

```
<strong>Price: </strong>$<?php echo $route->price;?>

```

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 8, 2011, 3:36pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/8 "2011-04-08T15:36:19Z")

</div>

Nice Jeff! Thanks man. That worked out great.

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 8, 2011, 3:41pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/9 "2011-04-08T15:41:33Z")

</div>

You know what… I just noticed, it is showing ticket price for passengers or cargo charge. Ijust saw one flight valued at $2.95 lol I wonder how many pilots would turn down that job. And at $2.95 that same flight actually pays the pilot like $1100 I believe it was.

That works if we wish to show how much we are charging the passenger or cargo for the flight. I need to figure out how to make it show me how much cash the pilot will be paid for said flight. Not sure if we can do that or not with the pilot pay by the hour or per flight. I am sure there is a way though. The trick is to figure it out.

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 11, 2011, 4:54pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/10 "2011-04-11T16:54:44Z")

</div>

I un-marked this one as solved. It is kind of solved. I have played with code until I was blue in the face and I can not get this to pull the pilot pay for a flight one. Using the code suggested above, it does pull either the ticket price or cargo per unit charge and echos it, but it will not show the actual pilot pay.

---

<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 11, 2011, 7:01pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/11 "2011-04-11T19:01:42Z")

</div>

Did you try $route-\>pilotpay?

If you do:

```
echo '<pre>'; print_r($route); echo '</pre>';

```

It will tell you all of the contents of the $route variable, you can pick and chose what you want

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 12, 2011, 4:20pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/12 "2011-04-12T16:20:42Z")

</div>

> Did you try $route-\>pilotpay?
> 
> If you do:
> 
> echo ‘
> 
> ```
> ’; print_r($route); echo ‘
> ```
> ’;
> 
> It will tell you all of the contents of the $route variable, you can pick and chose what you want

Nope I don’t think I traveled down that road Nabeel. I’ll give that a go here in a few minutes. I think I tried every thing but that one.

---

<div class="post-metadata">

**Author:** ![TAV1702](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tav1702/32/41_2.png) [@TAV1702](https://forum.phpvms.net/u/TAV1702)\
**Post date:** [April 12, 2011, 4:36pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/13 "2011-04-12T16:36:03Z")

</div>

GOT IT! Thanks Nabeel!

To show the pilot pay the code is:

```
<strong>Flight Value: </strong>$<?php echo $route->payforflight;?>

```

I have to remember to use that print r thing. It has saved my bacon more than once now.

---

<div class="post-metadata">

**Author:** ![Jeff](https://forum.phpvms.net/user_avatar/forum.phpvms.net/jeff/32/78_2.png) [@Jeff](https://forum.phpvms.net/u/Jeff)\
**Post date:** [May 3, 2011, 5:05am UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/14 "2011-05-03T05:05:03Z")

</div>

Ray…

I added this code and i get a blank number after the “$”

AC1144 (CYQB - CYYZ)

Departure: 1:15 Arrival: 2:42

Equipment: CRJ-700 (AC-CRJ7) Distance: 395.813nm

Days Flown: M T W Th F S Su

Airline: Air Canada Jazz

Flight Type: Passenger

Price: $135

Flight Value: $ \<----------------It is blank

---

<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:** [May 3, 2011, 7:12pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/15 "2011-05-03T19:12:38Z")

</div>

Try the print\_r trick to see what variables are populated

---

<div class="post-metadata">

**Author:** ![Jeff](https://forum.phpvms.net/user_avatar/forum.phpvms.net/jeff/32/78_2.png) [@Jeff](https://forum.phpvms.net/u/Jeff)\
**Post date:** [May 3, 2011, 7:28pm UTC](https://forum.phpvms.net/t/schedules-results-page-solved/4455/16 "2011-05-03T19:28:00Z")

</div>

I noticed on some flights it was showing: $ This flight has been bid on
